From 14b92ee71fbba6029b188002950d7c6aa6a50edf Mon Sep 17 00:00:00 2001 From: Archmonger <16909269+Archmonger@users.noreply.github.com> Date: Thu, 14 Sep 2023 18:57:28 -0700 Subject: [PATCH 01/20] Quick draft of preloading --- .../templates/reactpy/component.html | 8 ++-- src/reactpy_django/templatetags/reactpy.py | 39 ++++++++++++++++++- src/reactpy_django/utils.py | 18 +++++++++ tests/test_app/components.py | 39 +++++++++++++++++++ tests/test_app/templates/preload.html | 25 ++++++++++++ tests/test_app/urls.py | 10 +++-- tests/test_app/views.py | 4 ++ 7 files changed, 135 insertions(+), 8 deletions(-) create mode 100644 tests/test_app/templates/preload.html diff --git a/src/reactpy_django/templates/reactpy/component.html b/src/reactpy_django/templates/reactpy/component.html index 75a65dbe..418223b0 100644 --- a/src/reactpy_django/templates/reactpy/component.html +++ b/src/reactpy_django/templates/reactpy/component.html @@ -1,9 +1,11 @@ {% load static %} -{% if reactpy_failure %} -{% if reactpy_debug_mode %} + +{% if reactpy_failure and reactpy_debug_mode %} {% firstof reactpy_error "UnknownError" %}: "{% firstof reactpy_dotted_path "UnknownPath" %}" {% endif %} -{% else %} + +{% if not reactpy_failure %} +{% if reactpy_preload %}