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

Save and re-use views from memory store #78

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

eleventigers
Copy link
Contributor

When view are created via Handlebars view helper, they are added to a memory store like models and collections. Later when BaseView tries to re-attach views to DOM it looks up memory store for the same name view.
I am not sure if using fetcher to hold viewStore is a good idea as fetcher mainly deals with serializeable data. Any ideas where we could store views?

@@ -60,6 +60,10 @@ module.exports = BaseView = Backbone.View.extend({
options.collection_params = options.collection.params;
}

if(options.preventPostInitialize){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We wouldn't need preventPostInitialize anymore, right?

@spikebrehm
Copy link
Member

I like the approach, however I don't think it's appropriate to use MemoryStore for this; there's no point in holding on to instances of the view after we're done rendering & attaching. If we keep an instance in the store for every view, pretty soon we'll run out of memory after using the app for awhile. It could be a bit simpler to have a ViewStore that purges the cached value after it's been grabbed from the cache.

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

Successfully merging this pull request may close these issues.

None yet

2 participants