Skip to content
This repository has been archived by the owner on Jun 29, 2021. It is now read-only.

A named ReactiveDict should have an API to tear down the migrated data #76

Closed
rclai opened this issue Jun 10, 2017 · 7 comments
Closed

Comments

@rclai
Copy link

rclai commented Jun 10, 2017

Migrated from: meteor/meteor#4585

@zimme
Copy link

zimme commented Jun 11, 2017

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

@zimme
Copy link

zimme commented Jun 11, 2017

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()?

@rclai
Copy link
Author

rclai commented Jun 12, 2017

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.

@zimme
Copy link

zimme commented Jun 12, 2017

@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?

@rclai
Copy link
Author

rclai commented Jun 12, 2017

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

@zimme
Copy link

zimme commented Oct 18, 2017

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

@hwillson
Copy link
Contributor

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants