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

add alternate detection methods #84

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

add alternate detection methods #84

wants to merge 2 commits into from

Conversation

redxtech
Copy link

I have created this PR to allow this component to function with multiple prerendering libraries. The ones I have tested so far are below:

Library Working Notes
react-snap ✔️ details
prerender-spa-plugin not tested yet details
presite not implemented yet awaiting response from library author
snapshotify not implemented yet awaiting response from library author
prerenderer not implemented yet awaiting response from library author
prep not implemented yet awaiting response from library author

I will update this PR as I hear back from the library authors. I will also happily add detection methods for other libraries as requested if I can find out how to detect that the app is being prerendered.

@egoist
Copy link
Owner

egoist commented Aug 19, 2020

I prefer exposing a prop like shouldRender over directly support every possible use case in this library.

@redxtech
Copy link
Author

Ah ok. By this do you mean a shouldRender prop that you pass whatever expression that your prerendering library uses to signify that it is being used? If so, I can definitely see why, as I am also usually a fan of a general solution instead of numerous hard-coded solutions.

This being said, I still have a few concerns with just using a shouldRender prop:

  1. Wouldn't this result in a bunch of boilerplate code? Having to add the exact same prop to each instance of the component throughout a project seems rather repetitive. A single prop may not be much on its own, but it's still something extra that you have to remember and add each time you use it.
  2. Since this currently adds very little complexity, wouldn't it make sense to choose the "zero config" option? If it was more complex to hard-code a few libraries by default I would definitely agree, but at the moment it is not.

Perhaps including a few hard-coded options for some of the more popular libraries while also including a shouldRender prop would be a solution that combines the best of both worlds?

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.

2 participants