Skip to content

Conversation

@Archmonger
Copy link
Contributor

@Archmonger Archmonger commented Sep 15, 2023

By submitting this pull request you agree that all contributions to this project are made under the MIT license.

Description

  • SEO compatible rendering
    • Prerenders the initial component via the template tag using vdom_to_html, then loads the actual component in the background within a hidden div. When loaded, the prerender is replaced with the actual render.
    • settings.py:REACTPY_PRERENDER can be set to True to enable this behavior by default
    • Enable it on individual components via the template tag: {% component "..." prerender="True" %}
  • Docs styling, verbiage, and formatting tweaks
  • Rename undocumented utility function reactpy_django.utils.ComponentPreloader to reactpy_django.utils.RootComponentFinder.
  • Fix JavaScript being via pip install -e . on Windows.
  • Update PyPi package metadata
  • Update pull request template

Checklist:

Please update this checklist as you complete each item:

  • Tests have been included for all bug fixes or added functionality.
  • The changelog has been updated with any significant changes, if necessary.
  • GitHub Issues which may be closed by this PR have been linked.

@Archmonger Archmonger linked an issue Sep 15, 2023 that may be closed by this pull request
@Archmonger Archmonger marked this pull request as ready for review September 15, 2023 07:31
@Archmonger Archmonger requested a review from a team as a code owner September 15, 2023 07:31
@Archmonger Archmonger merged commit 1fbdfbb into reactive-python:main Sep 16, 2023
@Archmonger Archmonger deleted the seo-compatible-rendering branch September 16, 2023 04:14
@Archmonger
Copy link
Contributor Author

Archmonger commented Sep 16, 2023

@rmorshea BTW after a lot of testing, the most rational approach for this was to prerender in a separate div, then replace it with the actual render when possible. The prerendering step is performed entirely by the template tag.

Saves us from cross-process rehydration headaches, and is the most compatible solution across multiple backends.

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.

SEO compatible rendering

1 participant