Meteor-feature-requests: A named ReactiveDict should have an API to tear down the migrated data

Created on 10 Jun 2017  路  7Comments  路  Source: meteor/meteor-feature-requests

Migrated from: meteor/meteor#4585

Tracker

Most helpful comment

Excellent - thanks for the reminder @zimme (and the PR)!

All 7 comments

I'm thinking .destroy() which would call .clear() and unregister the dict from migration.

To avoid having to remove the migrated data on destroy() we could just update _loadMigratedDict() to clear it's reference to the data before it returns it.

I have preliminary version here https://github.com/zimme/meteor/tree/zimme/reactive-dict

I'm not sure about .destroy() as a name though, maybe clearMigrationData() and don't have it call clear()? Is there ever a need to "clear" the migration data without clearing the actual dict data? If there is, maybe it should be called unregister()?

To avoid having to remove the migrated data on destroy() we could just update _loadMigratedDict() to clear it's reference to the data before it returns it.

Honestly, I think it should just do that because it solves the re-instantiaion issue that I had.

@rclai, I don't believe it will because when you create a named ReactiveDict it registers itself with ReactiveDict._dictsToMigrate which is a list of dicts to migrate and this is what is checked whenever a new named ReactiveDict is created via _registerDictForMigrate.

The updated _loadMigratedDict function just removes the reference to the migrated data in ReactiveDict._migratedDictData and doesn't touch ReactiveDict._dictsToMigrate,
so the re-instantiated error should still happen, right?

Oh my mistake didn't realize they were two different properties.

@hwillson, this can be closed as meteor/meteor#9063 is merged.

Excellent - thanks for the reminder @zimme (and the PR)!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mwarren2 picture mwarren2  路  31Comments

Saeeed-B picture Saeeed-B  路  24Comments

meggarr picture meggarr  路  34Comments

mitar picture mitar  路  65Comments

joncursi picture joncursi  路  19Comments