Skip to content

[LiveComponent] Fix LiveUrlSubscriber throw MethodNotAllowed #2961

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 30, 2025

Conversation

smnandre
Copy link
Member

@smnandre smnandre commented Jul 29, 2025

Q A
Bug fix? yes
New feature? no
Docs? no
Issues Fix #2960
License MIT

Warning

Not sure this is enough, but If anyone wants to build on it, feel free - wont be around tomorrow.


The new LiveUrlSubscriber calls the Router to match the previous Url.

At that instant, the RoutingContext is most of the time in POST, and so calling router->match($previousUrl) would throw a MethodNotAllowedException


Most recent commit (Catch MethodNotAllowedException) fixes this issue ... but I think we have probably other use cases where it would not work.

My previous commit (reverted in the current state) Force RequestsContext to "GET" seems a more promising lead.

And the first one (reverted too in current state) No LiveProps no change was to avoid entirely the generation when no props were extracted from URL... sadly i don't think it's enough to say "no props should now be used in URL".. ?


Thank you @zacharylund for the investigation and @jmsche for the perfect reproducer

@carsonbot carsonbot added Bug Bug Fix Status: Needs Review Needs to be reviewed labels Jul 29, 2025
@smnandre smnandre changed the title Fix/live url mapping match [LiveComponent] Fix LiveUrlSubsriber throw MethodNotAllowed Jul 29, 2025
Copy link
Member

@Kocal Kocal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the reactivity 🙏🏻

@carsonbot carsonbot added Status: Reviewed Has been reviewed by a maintainer and removed Status: Needs Review Needs to be reviewed labels Jul 30, 2025
@Kocal
Copy link
Member

Kocal commented Jul 30, 2025

@Amoifr
Copy link

Amoifr commented Jul 30, 2025

Thx for this MR. Waiting about this live. I found a workaround adding method in my attributes
#[AsLiveComponent(name: 'filter_bar_brand_filter', template: 'front/components/common/filter_bar/brand_filter.html.twig', method:'get')]

@mpysiak
Copy link

mpysiak commented Jul 30, 2025

Thanks 🙌 This bug has caused quite a few issues in Sylius. Do you have plans to release a patch soon?

@jmsche
Copy link
Contributor

jmsche commented Jul 30, 2025

Hello there, I can confirm the patch fixes the reported issue :)

@Kocal
Copy link
Member

Kocal commented Jul 30, 2025

We can release this MR today I think.

I wish we could have fixed #2963 before, but I think we will tag a 2nd release later

@Kocal Kocal changed the title [LiveComponent] Fix LiveUrlSubsriber throw MethodNotAllowed [LiveComponent] Fix LiveUrlSubscriber throw MethodNotAllowed Jul 30, 2025
@Kocal Kocal changed the title [LiveComponent] Fix LiveUrlSubscriber throw MethodNotAllowed [LiveComponent] Fix LiveUrlSubscriber throw MethodNotAllowed Jul 30, 2025
@GSadee
Copy link

GSadee commented Jul 30, 2025

Thanks for your quick response and PR 💪🏻

We have tested this workaround in Sylius and can confirm that it solves the problem. We would greatly appreciate a patch as soon as possible 🙏🏻

@Kocal
Copy link
Member

Kocal commented Jul 30, 2025

Thanks, such confirmations help us to move forward ✨

cc @smnandre @kbond are we fine with merging it and releasing it today?

@davidnectarestudio
Copy link

Same problem here

@kbond kbond force-pushed the fix/live-url-mapping-match branch from 1da8a7b to 5b8d701 Compare July 30, 2025 12:22
@kbond
Copy link
Member

kbond commented Jul 30, 2025

Thank you Simon.

@kbond kbond merged commit 6940885 into symfony:2.x Jul 30, 2025
23 of 25 checks passed
@kbond
Copy link
Member

kbond commented Jul 30, 2025

2.28.2 released

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug Fix LiveComponent Status: Reviewed Has been reviewed by a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[LiveComponent] 500 errors with MethodNotAllowedException on dev after 2.28 upgrade
9 participants