Turn off behavior for SuperMap?

For security reasons, I want to turn off the fall-through-cache. I can’t figure out how to do so.

Thanks.

You probably just want to provide the memory cache instead of local storage cache. You can create a cacheConnection option with the memory cache behavior.

If you want to remove fall-through, you have to create your own connection. Copy and paste supermodel’s code.

Yes. Memory Cache hits my spot exactly. We should have a topic whose point is “Is there a module that…?”

Anyway, I made memory cache work but there’s something very strange going on.

The first time I access the component that references the data, I get

When I click away and return to the listing, I get the correct list

I can see the first admin item change to say debugDataVersion when I get there the second time.

I have done experiments that prove that it’s duplicating the last item as the first. Also, the data is coming correctly all the time.

I can’t imagine that this is correct behavior. Is there something else I should try?

The top part is the data element passed through parseInstanceData(). The bottom is the stuff that comes out of “var listData = baseConnect.getListData.call(self, set);”

Notice that items 0 and 3 are both map226, ie, the bad result with the last item duplicated in the first position.

It’s all the weird since it works correctly with localStorage.

Just to make sure, I removed the memory cache parameter and grabbed the corresponding screen shot. It is getting the stuff from the baseConnection correctly when using localStorage.

I note here that it sort of looks like the flaw is that, in the bad situation, map226 is written into data[3] and then filled with the fourth list element, admin, since map232 is missing.

Can you make a jsbin with your example code?

I am deeply embarrassed to say that I don’t know how to do that. Especially, I don’t know how to deal with “import”.

What I did instead is configure my demo site to run in dev mode so that the modules are visible in debugging.

http://demo.careplanner.tqtmp.org/

I made a twenty second video that shows how to reproduce the problem.

http://media.genericwhite.com/video?donejsMemoryCacheProblem

I hope this helps.

I think the problem might be b/c you need to configure the cacheConnection with the idProp

connect(["data-memory-cache"],{
  idProp: '_id',
  name: 'user-cache'
})

Yeah, that’s the problem.

The reason why this was showing up is because the first user was treated as the object with is as undefined. Every user object after that was writing all of its properties to that object. The last item, admin was the last to copy it’s properties to the first user object.

However, the cache connection should not be mutating data passed from the outside. Fixing this will have your page eventually show the right data even if the id wasn’t set right.

Thank you. That solved the problem for me. Looks like you are taking steps to solve it for the world.

Win!!