Skip to content

3.6.0

Compare
Choose a tag to compare
@Archmonger Archmonger released this 10 Jan 10:53
· 25 commits to main since this release
9607a8d

Added

  • Built-in Single Page Application (SPA) support!
    • reactpy_django.router.django_router can be used to render your Django application as a SPA.
  • SEO compatible rendering!
    • settings.py:REACTPY_PRERENDER can be set to True to make components pre-render by default.
    • Or, you can enable it on individual components via the template tag: {% component "..." prerender="True" %}.
  • New view_to_iframe feature!
    • reactpy_django.components.view_to_iframe uses an <iframe> to render a Django view.
    • reactpy_django.utils.register_iframe tells ReactPy which views view_to_iframe can use.
  • New Django User related features!
    • reactpy_django.hooks.use_user can be used to access the current user.
    • reactpy_django.hooks.use_user_data provides a simplified interface for storing user key-value data.
    • reactpy_django.decorators.user_passes_test is inspired by the equivalent Django decorator, but ours works with ReactPy components.
    • settings.py:REACTPY_AUTO_RELOGIN will cause component WebSocket connections to automatically re-login users that are already authenticated. This is useful to continuously update last_login timestamps and refresh the Django login session.

Changed

  • Renamed undocumented utility function ComponentPreloader to RootComponentFinder.
  • It is now recommended to call as_view() when using view_to_component or view_to_iframe with Class Based Views.
  • For thread safety, thread_sensitive=True has been enabled in all sync_to_async functions where ORM queries are possible.
  • reactpy_django.hooks.use_mutation now has a __call__ method. So rather than writing my_mutation.execute(...), you can now write my_mutation(...).

Deprecated

  • The compatibility argument on reactpy_django.components.view_to_component is deprecated.
    • Use view_to_iframe as a replacement.
  • reactpy_django.components.view_to_component usage as a decorator is deprecated.
    • Check the docs on how to use view_to_component as a function instead.
  • reactpy_django.decorators.auth_required is deprecated.
    • Use reactpy_django.decorators.user_passes_test instead.
    • An equivalent to auth_required's default is @user_passes_test(lambda user: user.is_active).