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

We lost caching! #42

Open
bcomnes opened this issue Apr 10, 2017 · 2 comments
Open

We lost caching! #42

bcomnes opened this issue Apr 10, 2017 · 2 comments

Comments

@bcomnes
Copy link
Collaborator

bcomnes commented Apr 10, 2017

I reread through the old cache-element code last night and compared it to the new cache-element, and I realized we lost some desirable behavior in the switchover to nanocomponent.

In the old cache-element, when the cache is invalidated, we do a pure re-render of the component and return that (just like a function that returns a belement). In the nanocomponent world, there simply is no way to do that. Nanocomponent will always return a proxy node and its up to you to internally morph any new changes.

Additionally, the current behavior of cache-element would be more aptly named freeze-element since once its rendered, it never updates again.

I propose that we take the current cache-element and turn it into a new component called freeze-element and then redo cache-element to work like it does in e5c5d74 but change it to use a prototype class API like nanocomponent uses. Or maybe do a cachelement (or call it horn? since trains have bel's and horns? edit: nm its taken :() that backs a higher level cache-element module in this repo that restores the old module's function signature?

I would be interested in doing this. What do you think about the name change?

@bcomnes
Copy link
Collaborator Author

bcomnes commented Apr 10, 2017

I took an initial stab at a base class at https://github.com/bcomnes/cached-element/blob/master/index.js

@bcomnes
Copy link
Collaborator Author

bcomnes commented Apr 10, 2017

Maybe we could restore the original API with this name, and cached-element (Or cachelement, or horn) could be a base class with similar consumption requirements as nanocomponent.

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

No branches or pull requests

1 participant