ux icon indicating copy to clipboard operation
ux copied to clipboard

[LiveComponent] The `data-poll` with no internet connection lead to broken component state

Open gremo opened this issue 1 year ago • 5 comments

I've a dashboard-like application, running on a tablet. Some of the live components use the data-poll to update the display data:

Screenshot 2024-03-21 100251

If connection isn't available for some reason the request is sent and will fail. This is obvious.

But... the live component seems to remain in a "broken" state and will never recover, that is the component will not re-render when the next data-poll occurs. In my specific case, data-poll is set to 60 seconds. Only a full page refresh will solve the issue.

Is there any way to "recover" the live component?

gremo avatar Mar 21 '24 09:03 gremo

Two ideas with 0% certitude there :

Did you try to manually handle errors or so with JS hooks ? https://symfony.com/bundles/ux-live-component/current/index.html#javascript-component-hooks

You could maybe even try to plug yourself into the Stimulus application (example in the stimulus handbook i think)

smnandre avatar Mar 24 '24 22:03 smnandre

@smnandre thanks for the idea. Was Just curious about why components do not "recover" from this kind of errors. It's the expected behaviour? WDYT?

By the way I think that "response:errore" hook will not be called in this situation since response will never be received... but not 100% sure.

gremo avatar Mar 24 '24 22:03 gremo

No, I think we need to consider this further. I'm just not ready to make any time-related promises. :)

smnandre avatar Mar 24 '24 22:03 smnandre