Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

rclai opened this issue Jun 10, 2017 · 7 comments

Comments

@rclai
Copy link

@rclai rclai commented Jun 10, 2017

Migrated from: meteor/meteor#4585

@zimme
Copy link

@zimme 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 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 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 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 rclai commented Jun 12, 2017

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

@zimme
Copy link

@zimme zimme commented Oct 18, 2017

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

@hwillson
Copy link
Member

@hwillson hwillson commented Oct 18, 2017

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

@hwillson hwillson closed this Oct 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.