[Solved] Is ReactiveDict still not updating on key insertion?

Back in May I found an issue and a workaround for ReactiveDict not updating when inserting new keys.

I found the issue while replacing Session with ReactiveDict. The workaround is to have a predefined key ‘fake’ and change it every time new keys are added to the dictionary, thus triggering recomputation.

On Stackoverflow, David Weldon answered it was due to the implementation in Meteor 1.1 and in an incoming implementation the issue would be fixed.

In between the Session package has been separated from the core and my understanding is we are recommended to avoid using it to prevent global namespace pollution, name clashes and make template reusing more robust by encapulating state in a reactive var / dict saved in the template instance.

I see the implementation has changed but I don’t see how to rewrite the loop I was using before, which still doesn’t update on first insert

const reactive_dict = new ReactiveDict()
for (let key in reactive_dict.keys) if (reactive_dict.get(key)) ...

Have you tried to use a local collection instead ? It’s more powerful for advanced usage, imho.

The answer was already given by David Weldon… I just didn’t get it

const reactive_dict = new ReactiveDict()
for (let key in reactive_dict.all()) if (reactive_dict.get(key)) ...