File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed
Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -209,3 +209,43 @@ updated default_value from the state.
209209Without the `key` set, the slider would always display the original
210210`settled_value` after a page reload, instead of its current value.
211211```
212+
213+ ## Temporal Events
214+
215+ _ Added in v0.5.0_
216+
217+ ### temporal
218+
219+ The ` .temporal ` action prevents events from being queued when the backend is down.
220+ This is useful for non-critical events where you don't want them to pile up if there's
221+ a temporary connection issue.
222+
223+ ``` md alert warning
224+ # Temporal events are discarded when the backend is down.
225+
226+ When the backend is unavailable, events with the `.temporal` action will be
227+ discarded rather than queued for later processing. Only use this for events
228+ where it's acceptable to lose some interactions during connection issues.
229+ ```
230+
231+ In the following example, the button's ` on_click ` handler uses ` .temporal ` to
232+ prevent clicks from being queued when the backend is down:
233+
234+ ``` python demo exec
235+ class TemporalState (rx .State ):
236+ count: int = 0
237+
238+ @rx.event
239+ def increment (self ):
240+ self .count += 1
241+
242+ def temporal_example ():
243+ return rx.vstack(
244+ rx.heading(f " Count: { TemporalState.count} " ),
245+ rx.button(
246+ " Increment (Temporal)" ,
247+ on_click = TemporalState.increment.temporal,
248+ ),
249+ rx.text(" This button's clicks won't be queued if the backend is down." ),
250+ )
251+ ```
You can’t perform that action at this time.
0 commit comments