reflex 0.7.0a5__py3-none-any.whl → 0.7.1a2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of reflex might be problematic. Click here for more details.
- reflex/.templates/web/components/reflex/radix_themes_color_mode_provider.js +3 -1
- reflex/__init__.py +1 -0
- reflex/__init__.pyi +1 -0
- reflex/app.py +255 -81
- reflex/base.py +4 -10
- reflex/compiler/compiler.py +46 -12
- reflex/compiler/templates.py +1 -2
- reflex/compiler/utils.py +23 -14
- reflex/components/base/bare.py +109 -16
- reflex/components/component.py +179 -124
- reflex/components/core/__init__.py +1 -0
- reflex/components/core/__init__.pyi +1 -0
- reflex/components/core/auto_scroll.py +111 -0
- reflex/components/core/auto_scroll.pyi +284 -0
- reflex/components/core/banner.py +40 -9
- reflex/components/core/banner.pyi +400 -87
- reflex/components/core/breakpoints.py +1 -1
- reflex/components/core/cond.py +0 -8
- reflex/components/core/foreach.py +12 -2
- reflex/components/core/html.pyi +200 -19
- reflex/components/core/match.py +4 -4
- reflex/components/core/sticky.pyi +874 -90
- reflex/components/core/upload.py +3 -5
- reflex/components/core/upload.pyi +2 -4
- reflex/components/datadisplay/code.py +36 -10
- reflex/components/datadisplay/code.pyi +1 -1
- reflex/components/datadisplay/dataeditor.py +1 -3
- reflex/components/datadisplay/dataeditor.pyi +1 -3
- reflex/components/el/elements/base.py +95 -17
- reflex/components/el/elements/base.pyi +278 -19
- reflex/components/el/elements/forms.py +124 -102
- reflex/components/el/elements/forms.pyi +2787 -365
- reflex/components/el/elements/inline.py +24 -15
- reflex/components/el/elements/inline.pyi +5655 -546
- reflex/components/el/elements/media.py +79 -95
- reflex/components/el/elements/media.pyi +5167 -565
- reflex/components/el/elements/metadata.py +19 -17
- reflex/components/el/elements/metadata.pyi +841 -89
- reflex/components/el/elements/other.py +3 -5
- reflex/components/el/elements/other.pyi +1404 -137
- reflex/components/el/elements/scripts.py +10 -13
- reflex/components/el/elements/scripts.pyi +634 -65
- reflex/components/el/elements/sectioning.pyi +3001 -286
- reflex/components/el/elements/tables.py +14 -35
- reflex/components/el/elements/tables.pyi +2029 -218
- reflex/components/el/elements/typography.py +10 -13
- reflex/components/el/elements/typography.pyi +3014 -297
- reflex/components/lucide/icon.py +22 -6
- reflex/components/markdown/markdown.py +30 -10
- reflex/components/markdown/markdown.pyi +3 -2
- reflex/components/plotly/plotly.py +1 -3
- reflex/components/plotly/plotly.pyi +1 -3
- reflex/components/radix/primitives/form.pyi +624 -93
- reflex/components/radix/themes/color_mode.py +1 -1
- reflex/components/radix/themes/color_mode.pyi +213 -31
- reflex/components/radix/themes/components/alert_dialog.pyi +199 -18
- reflex/components/radix/themes/components/badge.pyi +199 -18
- reflex/components/radix/themes/components/button.pyi +213 -31
- reflex/components/radix/themes/components/callout.pyi +1000 -95
- reflex/components/radix/themes/components/card.pyi +199 -18
- reflex/components/radix/themes/components/context_menu.py +79 -1
- reflex/components/radix/themes/components/context_menu.pyi +320 -1
- reflex/components/radix/themes/components/dialog.pyi +199 -18
- reflex/components/radix/themes/components/hover_card.pyi +199 -18
- reflex/components/radix/themes/components/icon_button.pyi +213 -31
- reflex/components/radix/themes/components/inset.pyi +199 -18
- reflex/components/radix/themes/components/popover.pyi +199 -18
- reflex/components/radix/themes/components/table.pyi +1437 -154
- reflex/components/radix/themes/components/text_area.py +2 -2
- reflex/components/radix/themes/components/text_area.pyi +201 -20
- reflex/components/radix/themes/components/text_field.py +1 -1
- reflex/components/radix/themes/components/text_field.pyi +444 -88
- reflex/components/radix/themes/layout/box.pyi +200 -19
- reflex/components/radix/themes/layout/center.pyi +199 -18
- reflex/components/radix/themes/layout/container.pyi +199 -18
- reflex/components/radix/themes/layout/flex.pyi +199 -18
- reflex/components/radix/themes/layout/grid.pyi +199 -18
- reflex/components/radix/themes/layout/list.pyi +604 -57
- reflex/components/radix/themes/layout/section.pyi +199 -18
- reflex/components/radix/themes/layout/spacer.pyi +199 -18
- reflex/components/radix/themes/layout/stack.pyi +597 -54
- reflex/components/radix/themes/typography/blockquote.pyi +200 -19
- reflex/components/radix/themes/typography/code.pyi +199 -18
- reflex/components/radix/themes/typography/heading.pyi +199 -18
- reflex/components/radix/themes/typography/link.pyi +238 -28
- reflex/components/radix/themes/typography/text.pyi +1394 -127
- reflex/components/react_player/react_player.py +1 -1
- reflex/components/react_player/react_player.pyi +1 -3
- reflex/components/sonner/toast.py +41 -12
- reflex/components/sonner/toast.pyi +20 -6
- reflex/components/tags/iter_tag.py +4 -0
- reflex/components/tags/tag.py +3 -3
- reflex/config.py +187 -28
- reflex/constants/__init__.py +2 -0
- reflex/constants/base.py +6 -0
- reflex/constants/compiler.py +9 -0
- reflex/constants/event.py +1 -0
- reflex/constants/installer.py +4 -5
- reflex/constants/utils.py +1 -3
- reflex/event.py +7 -16
- reflex/experimental/layout.pyi +597 -54
- reflex/py.typed +0 -0
- reflex/reflex.py +30 -41
- reflex/state.py +49 -44
- reflex/style.py +15 -22
- reflex/testing.py +2 -0
- reflex/utils/build.py +12 -0
- reflex/utils/console.py +4 -0
- reflex/utils/decorator.py +25 -0
- reflex/utils/exec.py +92 -34
- reflex/utils/format.py +35 -6
- reflex/utils/path_ops.py +16 -1
- reflex/utils/prerequisites.py +34 -8
- reflex/utils/processes.py +12 -13
- reflex/utils/serializers.py +20 -43
- reflex/utils/telemetry.py +4 -15
- reflex/utils/types.py +36 -66
- reflex/vars/base.py +53 -76
- reflex/vars/function.py +17 -5
- reflex/vars/number.py +1 -1
- reflex/vars/sequence.py +80 -4
- {reflex-0.7.0a5.dist-info → reflex-0.7.1a2.dist-info}/METADATA +4 -5
- {reflex-0.7.0a5.dist-info → reflex-0.7.1a2.dist-info}/RECORD +126 -122
- {reflex-0.7.0a5.dist-info → reflex-0.7.1a2.dist-info}/LICENSE +0 -0
- {reflex-0.7.0a5.dist-info → reflex-0.7.1a2.dist-info}/WHEEL +0 -0
- {reflex-0.7.0a5.dist-info → reflex-0.7.1a2.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
"""Stub file for reflex/components/core/auto_scroll.py"""
|
|
2
|
+
|
|
3
|
+
# ------------------- DO NOT EDIT ----------------------
|
|
4
|
+
# This file was generated by `reflex/utils/pyi_generator.py`!
|
|
5
|
+
# ------------------------------------------------------
|
|
6
|
+
from typing import Any, Dict, Literal, Optional, Union, overload
|
|
7
|
+
|
|
8
|
+
from reflex.components.el.elements.typography import Div
|
|
9
|
+
from reflex.event import EventType
|
|
10
|
+
from reflex.style import Style
|
|
11
|
+
from reflex.utils.imports import ImportDict
|
|
12
|
+
from reflex.vars.base import Var
|
|
13
|
+
|
|
14
|
+
class AutoScroll(Div):
|
|
15
|
+
@overload
|
|
16
|
+
@classmethod
|
|
17
|
+
def create( # type: ignore
|
|
18
|
+
cls,
|
|
19
|
+
*children,
|
|
20
|
+
access_key: Optional[Union[Var[str], str]] = None,
|
|
21
|
+
auto_capitalize: Optional[
|
|
22
|
+
Union[
|
|
23
|
+
Literal["characters", "none", "off", "on", "sentences", "words"],
|
|
24
|
+
Var[Literal["characters", "none", "off", "on", "sentences", "words"]],
|
|
25
|
+
]
|
|
26
|
+
] = None,
|
|
27
|
+
content_editable: Optional[
|
|
28
|
+
Union[
|
|
29
|
+
Literal["inherit", "plaintext-only", False, True],
|
|
30
|
+
Var[Literal["inherit", "plaintext-only", False, True]],
|
|
31
|
+
]
|
|
32
|
+
] = None,
|
|
33
|
+
context_menu: Optional[Union[Var[str], str]] = None,
|
|
34
|
+
dir: Optional[Union[Var[str], str]] = None,
|
|
35
|
+
draggable: Optional[Union[Var[bool], bool]] = None,
|
|
36
|
+
enter_key_hint: Optional[
|
|
37
|
+
Union[
|
|
38
|
+
Literal["done", "enter", "go", "next", "previous", "search", "send"],
|
|
39
|
+
Var[
|
|
40
|
+
Literal["done", "enter", "go", "next", "previous", "search", "send"]
|
|
41
|
+
],
|
|
42
|
+
]
|
|
43
|
+
] = None,
|
|
44
|
+
hidden: Optional[Union[Var[bool], bool]] = None,
|
|
45
|
+
input_mode: Optional[
|
|
46
|
+
Union[
|
|
47
|
+
Literal[
|
|
48
|
+
"decimal",
|
|
49
|
+
"email",
|
|
50
|
+
"none",
|
|
51
|
+
"numeric",
|
|
52
|
+
"search",
|
|
53
|
+
"tel",
|
|
54
|
+
"text",
|
|
55
|
+
"url",
|
|
56
|
+
],
|
|
57
|
+
Var[
|
|
58
|
+
Literal[
|
|
59
|
+
"decimal",
|
|
60
|
+
"email",
|
|
61
|
+
"none",
|
|
62
|
+
"numeric",
|
|
63
|
+
"search",
|
|
64
|
+
"tel",
|
|
65
|
+
"text",
|
|
66
|
+
"url",
|
|
67
|
+
]
|
|
68
|
+
],
|
|
69
|
+
]
|
|
70
|
+
] = None,
|
|
71
|
+
item_prop: Optional[Union[Var[str], str]] = None,
|
|
72
|
+
lang: Optional[Union[Var[str], str]] = None,
|
|
73
|
+
role: Optional[
|
|
74
|
+
Union[
|
|
75
|
+
Literal[
|
|
76
|
+
"alert",
|
|
77
|
+
"alertdialog",
|
|
78
|
+
"application",
|
|
79
|
+
"article",
|
|
80
|
+
"banner",
|
|
81
|
+
"button",
|
|
82
|
+
"cell",
|
|
83
|
+
"checkbox",
|
|
84
|
+
"columnheader",
|
|
85
|
+
"combobox",
|
|
86
|
+
"complementary",
|
|
87
|
+
"contentinfo",
|
|
88
|
+
"definition",
|
|
89
|
+
"dialog",
|
|
90
|
+
"directory",
|
|
91
|
+
"document",
|
|
92
|
+
"feed",
|
|
93
|
+
"figure",
|
|
94
|
+
"form",
|
|
95
|
+
"grid",
|
|
96
|
+
"gridcell",
|
|
97
|
+
"group",
|
|
98
|
+
"heading",
|
|
99
|
+
"img",
|
|
100
|
+
"link",
|
|
101
|
+
"list",
|
|
102
|
+
"listbox",
|
|
103
|
+
"listitem",
|
|
104
|
+
"log",
|
|
105
|
+
"main",
|
|
106
|
+
"marquee",
|
|
107
|
+
"math",
|
|
108
|
+
"menu",
|
|
109
|
+
"menubar",
|
|
110
|
+
"menuitem",
|
|
111
|
+
"menuitemcheckbox",
|
|
112
|
+
"menuitemradio",
|
|
113
|
+
"navigation",
|
|
114
|
+
"none",
|
|
115
|
+
"note",
|
|
116
|
+
"option",
|
|
117
|
+
"presentation",
|
|
118
|
+
"progressbar",
|
|
119
|
+
"radio",
|
|
120
|
+
"radiogroup",
|
|
121
|
+
"region",
|
|
122
|
+
"row",
|
|
123
|
+
"rowgroup",
|
|
124
|
+
"rowheader",
|
|
125
|
+
"scrollbar",
|
|
126
|
+
"search",
|
|
127
|
+
"searchbox",
|
|
128
|
+
"separator",
|
|
129
|
+
"slider",
|
|
130
|
+
"spinbutton",
|
|
131
|
+
"status",
|
|
132
|
+
"switch",
|
|
133
|
+
"tab",
|
|
134
|
+
"table",
|
|
135
|
+
"tablist",
|
|
136
|
+
"tabpanel",
|
|
137
|
+
"term",
|
|
138
|
+
"textbox",
|
|
139
|
+
"timer",
|
|
140
|
+
"toolbar",
|
|
141
|
+
"tooltip",
|
|
142
|
+
"tree",
|
|
143
|
+
"treegrid",
|
|
144
|
+
"treeitem",
|
|
145
|
+
],
|
|
146
|
+
Var[
|
|
147
|
+
Literal[
|
|
148
|
+
"alert",
|
|
149
|
+
"alertdialog",
|
|
150
|
+
"application",
|
|
151
|
+
"article",
|
|
152
|
+
"banner",
|
|
153
|
+
"button",
|
|
154
|
+
"cell",
|
|
155
|
+
"checkbox",
|
|
156
|
+
"columnheader",
|
|
157
|
+
"combobox",
|
|
158
|
+
"complementary",
|
|
159
|
+
"contentinfo",
|
|
160
|
+
"definition",
|
|
161
|
+
"dialog",
|
|
162
|
+
"directory",
|
|
163
|
+
"document",
|
|
164
|
+
"feed",
|
|
165
|
+
"figure",
|
|
166
|
+
"form",
|
|
167
|
+
"grid",
|
|
168
|
+
"gridcell",
|
|
169
|
+
"group",
|
|
170
|
+
"heading",
|
|
171
|
+
"img",
|
|
172
|
+
"link",
|
|
173
|
+
"list",
|
|
174
|
+
"listbox",
|
|
175
|
+
"listitem",
|
|
176
|
+
"log",
|
|
177
|
+
"main",
|
|
178
|
+
"marquee",
|
|
179
|
+
"math",
|
|
180
|
+
"menu",
|
|
181
|
+
"menubar",
|
|
182
|
+
"menuitem",
|
|
183
|
+
"menuitemcheckbox",
|
|
184
|
+
"menuitemradio",
|
|
185
|
+
"navigation",
|
|
186
|
+
"none",
|
|
187
|
+
"note",
|
|
188
|
+
"option",
|
|
189
|
+
"presentation",
|
|
190
|
+
"progressbar",
|
|
191
|
+
"radio",
|
|
192
|
+
"radiogroup",
|
|
193
|
+
"region",
|
|
194
|
+
"row",
|
|
195
|
+
"rowgroup",
|
|
196
|
+
"rowheader",
|
|
197
|
+
"scrollbar",
|
|
198
|
+
"search",
|
|
199
|
+
"searchbox",
|
|
200
|
+
"separator",
|
|
201
|
+
"slider",
|
|
202
|
+
"spinbutton",
|
|
203
|
+
"status",
|
|
204
|
+
"switch",
|
|
205
|
+
"tab",
|
|
206
|
+
"table",
|
|
207
|
+
"tablist",
|
|
208
|
+
"tabpanel",
|
|
209
|
+
"term",
|
|
210
|
+
"textbox",
|
|
211
|
+
"timer",
|
|
212
|
+
"toolbar",
|
|
213
|
+
"tooltip",
|
|
214
|
+
"tree",
|
|
215
|
+
"treegrid",
|
|
216
|
+
"treeitem",
|
|
217
|
+
]
|
|
218
|
+
],
|
|
219
|
+
]
|
|
220
|
+
] = None,
|
|
221
|
+
slot: Optional[Union[Var[str], str]] = None,
|
|
222
|
+
spell_check: Optional[Union[Var[bool], bool]] = None,
|
|
223
|
+
tab_index: Optional[Union[Var[int], int]] = None,
|
|
224
|
+
title: Optional[Union[Var[str], str]] = None,
|
|
225
|
+
style: Optional[Style] = None,
|
|
226
|
+
key: Optional[Any] = None,
|
|
227
|
+
id: Optional[Any] = None,
|
|
228
|
+
class_name: Optional[Any] = None,
|
|
229
|
+
autofocus: Optional[bool] = None,
|
|
230
|
+
custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
|
|
231
|
+
on_blur: Optional[EventType[()]] = None,
|
|
232
|
+
on_click: Optional[EventType[()]] = None,
|
|
233
|
+
on_context_menu: Optional[EventType[()]] = None,
|
|
234
|
+
on_double_click: Optional[EventType[()]] = None,
|
|
235
|
+
on_focus: Optional[EventType[()]] = None,
|
|
236
|
+
on_mount: Optional[EventType[()]] = None,
|
|
237
|
+
on_mouse_down: Optional[EventType[()]] = None,
|
|
238
|
+
on_mouse_enter: Optional[EventType[()]] = None,
|
|
239
|
+
on_mouse_leave: Optional[EventType[()]] = None,
|
|
240
|
+
on_mouse_move: Optional[EventType[()]] = None,
|
|
241
|
+
on_mouse_out: Optional[EventType[()]] = None,
|
|
242
|
+
on_mouse_over: Optional[EventType[()]] = None,
|
|
243
|
+
on_mouse_up: Optional[EventType[()]] = None,
|
|
244
|
+
on_scroll: Optional[EventType[()]] = None,
|
|
245
|
+
on_unmount: Optional[EventType[()]] = None,
|
|
246
|
+
**props,
|
|
247
|
+
) -> "AutoScroll":
|
|
248
|
+
"""Create an AutoScroll component.
|
|
249
|
+
|
|
250
|
+
Args:
|
|
251
|
+
*children: The children of the component.
|
|
252
|
+
access_key: Provides a hint for generating a keyboard shortcut for the current element.
|
|
253
|
+
auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
|
|
254
|
+
content_editable: Indicates whether the element's content is editable.
|
|
255
|
+
context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
|
|
256
|
+
dir: Defines the text direction. Allowed values are ltr (Left-To-Right) or rtl (Right-To-Left)
|
|
257
|
+
draggable: Defines whether the element can be dragged.
|
|
258
|
+
enter_key_hint: Hints what media types the media element is able to play.
|
|
259
|
+
hidden: Defines whether the element is hidden.
|
|
260
|
+
input_mode: Defines the type of the element.
|
|
261
|
+
item_prop: Defines the name of the element for metadata purposes.
|
|
262
|
+
lang: Defines the language used in the element.
|
|
263
|
+
role: Defines the role of the element.
|
|
264
|
+
slot: Assigns a slot in a shadow DOM shadow tree to an element.
|
|
265
|
+
spell_check: Defines whether the element may be checked for spelling errors.
|
|
266
|
+
tab_index: Defines the position of the current element in the tabbing order.
|
|
267
|
+
title: Defines a tooltip for the element.
|
|
268
|
+
style: The style of the component.
|
|
269
|
+
key: A unique key for the component.
|
|
270
|
+
id: The id for the component.
|
|
271
|
+
class_name: The class name for the component.
|
|
272
|
+
autofocus: Whether the component should take the focus once the page is loaded
|
|
273
|
+
custom_attrs: custom attribute
|
|
274
|
+
**props: The props of the component.
|
|
275
|
+
|
|
276
|
+
Returns:
|
|
277
|
+
An AutoScroll component.
|
|
278
|
+
"""
|
|
279
|
+
...
|
|
280
|
+
|
|
281
|
+
def add_imports(self) -> ImportDict | list[ImportDict]: ...
|
|
282
|
+
def add_hooks(self) -> list[str | Var]: ...
|
|
283
|
+
|
|
284
|
+
auto_scroll = AutoScroll.create
|
reflex/components/core/banner.py
CHANGED
|
@@ -5,6 +5,7 @@ from __future__ import annotations
|
|
|
5
5
|
from typing import Optional
|
|
6
6
|
|
|
7
7
|
from reflex import constants
|
|
8
|
+
from reflex.components.base.fragment import Fragment
|
|
8
9
|
from reflex.components.component import Component
|
|
9
10
|
from reflex.components.core.cond import cond
|
|
10
11
|
from reflex.components.el.elements.typography import Div
|
|
@@ -16,7 +17,8 @@ from reflex.components.radix.themes.components.dialog import (
|
|
|
16
17
|
)
|
|
17
18
|
from reflex.components.radix.themes.layout.flex import Flex
|
|
18
19
|
from reflex.components.radix.themes.typography.text import Text
|
|
19
|
-
from reflex.components.sonner.toast import
|
|
20
|
+
from reflex.components.sonner.toast import ToastProps, toast_ref
|
|
21
|
+
from reflex.config import environment
|
|
20
22
|
from reflex.constants import Dirs, Hooks, Imports
|
|
21
23
|
from reflex.constants.compiler import CompileVars
|
|
22
24
|
from reflex.utils.imports import ImportVar
|
|
@@ -89,7 +91,7 @@ def default_connection_error() -> list[str | Var | Component]:
|
|
|
89
91
|
]
|
|
90
92
|
|
|
91
93
|
|
|
92
|
-
class ConnectionToaster(
|
|
94
|
+
class ConnectionToaster(Fragment):
|
|
93
95
|
"""A connection toaster component."""
|
|
94
96
|
|
|
95
97
|
def add_hooks(self) -> list[str | Var]:
|
|
@@ -109,9 +111,42 @@ class ConnectionToaster(Toaster):
|
|
|
109
111
|
id=toast_id,
|
|
110
112
|
) # pyright: ignore [reportCallIssue]
|
|
111
113
|
|
|
114
|
+
if environment.REFLEX_DOES_BACKEND_COLD_START.get():
|
|
115
|
+
loading_message = Var.create("Backend is starting.")
|
|
116
|
+
backend_is_loading_toast_var = Var(
|
|
117
|
+
f"toast?.loading({loading_message!s}, {{...toast_props, description: '', closeButton: false, onDismiss: () => setUserDismissed(true)}},)"
|
|
118
|
+
)
|
|
119
|
+
backend_is_not_responding = Var.create("Backend is not responding.")
|
|
120
|
+
backend_is_down_toast_var = Var(
|
|
121
|
+
f"toast?.error({backend_is_not_responding!s}, {{...toast_props, description: '', onDismiss: () => setUserDismissed(true)}},)"
|
|
122
|
+
)
|
|
123
|
+
toast_var = Var(
|
|
124
|
+
f"""
|
|
125
|
+
if (waitedForBackend) {{
|
|
126
|
+
{backend_is_down_toast_var!s}
|
|
127
|
+
}} else {{
|
|
128
|
+
{backend_is_loading_toast_var!s};
|
|
129
|
+
}}
|
|
130
|
+
setTimeout(() => {{
|
|
131
|
+
if ({has_too_many_connection_errors!s}) {{
|
|
132
|
+
setWaitedForBackend(true);
|
|
133
|
+
}}
|
|
134
|
+
}}, {environment.REFLEX_BACKEND_COLD_START_TIMEOUT.get() * 1000});
|
|
135
|
+
"""
|
|
136
|
+
)
|
|
137
|
+
else:
|
|
138
|
+
loading_message = Var.create(
|
|
139
|
+
f"Cannot connect to server: {connection_error}."
|
|
140
|
+
)
|
|
141
|
+
toast_var = Var(
|
|
142
|
+
f"toast?.error({loading_message!s}, {{...toast_props, onDismiss: () => setUserDismissed(true)}},)"
|
|
143
|
+
)
|
|
144
|
+
|
|
112
145
|
individual_hooks = [
|
|
146
|
+
Var(f"const toast = {toast_ref};"),
|
|
113
147
|
f"const toast_props = {LiteralVar.create(props)!s};",
|
|
114
148
|
"const [userDismissed, setUserDismissed] = useState(false);",
|
|
149
|
+
"const [waitedForBackend, setWaitedForBackend] = useState(false);",
|
|
115
150
|
FunctionStringVar(
|
|
116
151
|
"useEffect",
|
|
117
152
|
_var_data=VarData(
|
|
@@ -127,19 +162,16 @@ class ConnectionToaster(Toaster):
|
|
|
127
162
|
() => {{
|
|
128
163
|
if ({has_too_many_connection_errors!s}) {{
|
|
129
164
|
if (!userDismissed) {{
|
|
130
|
-
|
|
131
|
-
`Cannot connect to server: ${{{connection_error}}}.`,
|
|
132
|
-
{{...toast_props, onDismiss: () => setUserDismissed(true)}},
|
|
133
|
-
)
|
|
165
|
+
{toast_var!s}
|
|
134
166
|
}}
|
|
135
167
|
}} else {{
|
|
136
|
-
toast
|
|
168
|
+
toast?.dismiss("{toast_id}");
|
|
137
169
|
setUserDismissed(false); // after reconnection reset dismissed state
|
|
138
170
|
}}
|
|
139
171
|
}}
|
|
140
172
|
"""
|
|
141
173
|
),
|
|
142
|
-
LiteralArrayVar.create([connect_errors]),
|
|
174
|
+
LiteralArrayVar.create([connect_errors, Var("waitedForBackend")]),
|
|
143
175
|
),
|
|
144
176
|
]
|
|
145
177
|
|
|
@@ -159,7 +191,6 @@ class ConnectionToaster(Toaster):
|
|
|
159
191
|
Returns:
|
|
160
192
|
The connection toaster component.
|
|
161
193
|
"""
|
|
162
|
-
Toaster.is_used = True
|
|
163
194
|
return super().create(*children, **props)
|
|
164
195
|
|
|
165
196
|
|