Handling updates for private pages #3828
aranvir
started this conversation in
Ideas / Feature Requests
Replies: 1 comment 1 reply
-
Hi @aranvir, thanks for the suggestion! Some first thoughts about it:
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This is a follow-up to the question posted here: #3751
fyi @falkoschindler
Description
When building a multi-page application with
@ui.page()
, it's difficult to synchronize server-pushed content between all connected clients. To my understanding, this happens because the content of a page is scoped to each client connection and cannot be (reliably) found by the auto-context. Even when usingmark()
and theElementFilter()
it remains hidden since the page elements are created individually per "client-page-context".Workaround
I found a workaround to run updates within the scope of each connected client. The obvious downside is that this gets slower with each connected client.
Proposal
I propose to adapt and/or modify this approach to provide an out-of-the-box solution for applying server-side updates to private pages. The performance could be optimized by running the content of the for loop in parallel instead of sequentially.
Maybe there is also a more elegant solution to integrate this, e.g., within the
ElementFilter
to specify a "page scope". It already has the argumentlocal_scope
but it does not seem to help here.Example
As example I provide a simple application with 2 pages, where one page has a clock that shall be updated by the server.
Failing
The background job runs, but no update is applied since no element with the corresponding marker can be found.
Working with proposed solution
The update is applied to all connected tabs.
Beta Was this translation helpful? Give feedback.
All reactions