Skip to content

[LiveComponent] added basic error rendering of fetch failure and added request:error hook#3535

Open
FabianKoehnen wants to merge 2 commits into
symfony:3.xfrom
FabianKoehnen:bug/fetch-errors
Open

[LiveComponent] added basic error rendering of fetch failure and added request:error hook#3535
FabianKoehnen wants to merge 2 commits into
symfony:3.xfrom
FabianKoehnen:bug/fetch-errors

Conversation

@FabianKoehnen
Copy link
Copy Markdown

@FabianKoehnen FabianKoehnen commented May 11, 2026

Q A
Bug fix? yes
New feature? yes
Deprecations? no
Documentation? yes
Issues Fix #1986
License MIT

Hello, as described in the Issue currently there is problem that if an request fails the js freezes.
I looked into it and the issue is that there is currently no fetch.catch() to handle errors with the fetch itself.
As far as can see currently the code only handles faulty responses.

This Pr add:

  • prevention of the Js freeze
  • showing the error message in the error model
  • add a new request:error hook to handle this kind off errors

The request:error hook works mostly like response:error, so to prevent the modal from showing up you can do this:

this.component.on('request:error', (component, requestData, controls) => {
        controls.displayError = false;
});

Steps to reproduce the Error

  1. Create a LiveComponent with an Input for example a select.
  2. Open the Page
  3. In the Browser Dev Tools go to the Network Tab and set throttling to offline
  4. Change the Input to trigger a Request

@carsonbot carsonbot added Bug Bug Fix Documentation Improvements or additions to documentation Feature New Feature LiveComponent Status: Needs Review Needs to be reviewed labels May 11, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 11, 2026

📊 Packages dist files size difference

Thanks for the PR! Here is the difference in size of the packages dist files between the base branch and the PR.
Please review the changes and make sure they are expected.

FileBefore (Size / Gzip)After (Size / Gzip)
LiveComponent
live_controller.d.ts 7.54 kB / 1.96 kB 7.65 kB+1% 📈 / 1.97 kB0%
live_controller.js 82.61 kB / 18.38 kB 82.96 kB0% / 18.44 kB0%

@Kocal Kocal removed the Bug Bug Fix label May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Documentation Improvements or additions to documentation Feature New Feature LiveComponent Status: Needs Review Needs to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[LiveComponent] Error handling on Networking Errors

3 participants