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

Propsless components not caching #20

Open
maxpain opened this issue Dec 14, 2016 · 3 comments
Open

Propsless components not caching #20

maxpain opened this issue Dec 14, 2016 · 3 comments

Comments

@maxpain
Copy link

maxpain commented Dec 14, 2016

If component has no props, it will not be cached.

const canCache = (opts = cacheComponents[name]) && opts.enable && !(transaction._cached ||
    _.isEmpty(saveProps) || typeof saveProps.children === "object");

Maybe remove _.isEmpty(saveProps) check?

@sveisvei
Copy link

Seeing this as well. Stupid simple components without props are prime candidates for caching imo.

@niklaus0823
Copy link

When saveProps.children is null, typeof saveProps.children will return "object“

@anescobar1991
Copy link

anescobar1991 commented Jun 29, 2017

@niklaus0823 so is this a bug or the intended behaviour? should https://github.com/electrode-io/electrode-react-ssr-caching/blob/master/lib/ssr-caching.js#L242 be something like the below instead?

 _.isEmpty(saveProps) || (saveProps.children && typeof saveProps.children === "object"));

Can one of the core maintainers chip in on this to see if I should open PR?

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

4 participants