reactive-python / reactpy-django

It's React, but in Python. Now with Django integration.
https://reactive-python.github.io/reactpy-django/
MIT License
322 stars 18 forks source link

Add offline fallback to component template tags. #195

Closed Archmonger closed 7 months ago

Archmonger commented 11 months ago

Current Situation

Currently there is no way for the developers to gracefully handle websocket disconnections within ReactPy.

This results in an awkward situation where a page can be non-interactive due to a WebSocket disconnection, but visually looks completely normal.

Proposed Actions

Add an offline = <dotted_path> fallback to the component template tag.

This component will be non-interactive and is pre-rendered onto the page within a <component-uuid>-offline div. This div will be displayed when the websocket disconnects.

The interface will likely look like this:

{% "my.normal.component" offline="my.offline.fallback.component" %}