electrode-react-ssr-caching
electrode-react-ssr-caching copied to clipboard
Propsless components not caching
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?
Seeing this as well. Stupid simple components without props are prime candidates for caching imo.
When saveProps.children is null, typeof saveProps.children will return "object“
@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?