Skip to content

[LiveComponent] Refactor and fix some edgecases on new URL generation with path + query LiveProps - #3053

Merged
Kocal merged 1 commit into
symfony:2.xfrom
Kocal:fix-livecomponent-url-no-path-params
Aug 27, 2025
Merged

Kocal merged 1 commit into
symfony:2.xfrom
Kocal:fix-livecomponent-url-no-path-params

Conversation

@Kocal

@Kocal Kocal commented Aug 24, 2025 •

Copy link
Copy Markdown
Member
Q A
Bug fix? yes
New feature? no
Docs? no
Issues Fix #2987, fix #3015, fix #3052
License MIT

Follows #2673

This PR aims to fix the issues #2987, #3015, and #3052, by rewriting the logic to compute the new X-Live-Url when using LiveProp() (either with path paremeters or query parameters), inspired by @smnandre's work

@Kocal Kocal self-assigned this Aug 24, 2025
@carsonbot carsonbot added Bug Bug Fix LiveComponent Status: Needs Review Needs to be reviewed labels Aug 24, 2025
}
}
$newUrl = $this->router->generate($route, $parameters);
} catch (ResourceNotFoundException) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I removed the MethodNotAllowedException since I forced the context to GET method

@Kocal
Kocal force-pushed the fix-livecomponent-url-no-path-params branch from ee72505 to fffb7a1 Compare August 25, 2025 05:40
@Kocal
Kocal force-pushed the fix-livecomponent-url-no-path-params branch from fffb7a1 to be9c27e Compare August 25, 2025 05:42
@Kocal Kocal changed the title [LiveComponent] Refactor and fix (again) the new URL (with path and query LiveProps) generation [LiveComponent] Refactor and fix (again) the new URL (with path + query LiveProps) generation Aug 25, 2025
@Kocal
Kocal requested a review from smnandre August 25, 2025 05:46
@Kocal
Kocal force-pushed the fix-livecomponent-url-no-path-params branch 2 times, most recently from 8d93bd2 to c9ce9a7 Compare August 25, 2025 05:53

@smnandre smnandre left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice tests additions btw..

… just a tiny doubt on the path thing but ignore them if you are certain it cannot happen :)

And big Thank You

@carsonbot carsonbot added Status: Reviewed Has been reviewed by a maintainer and removed Status: Needs Review Needs to be reviewed labels Aug 25, 2025
@Kocal Kocal changed the title [LiveComponent] Refactor and fix (again) the new URL (with path + query LiveProps) generation [LiveComponent] Refactor and fix some edgecases on new URL generation with path + query LiveProps Aug 26, 2025
@Kocal
Kocal force-pushed the fix-livecomponent-url-no-path-params branch 3 times, most recently from 2cb9aed to 18b50c7 Compare August 27, 2025 07:00
@Kocal

Kocal commented Aug 27, 2025 •

Copy link
Copy Markdown
Member Author

I've just applied your comments @smnandre, which indeed fixed a case where a LiveProp(url: new UrlMapping(mapPath: true)) with a default value != null could be present in the URL as a query parameter, if the LiveProp didn't match a path parameter.

@Kocal
Kocal force-pushed the fix-livecomponent-url-no-path-params branch from 18b50c7 to 5c1441f Compare August 27, 2025 07:03
@Kocal

Kocal commented Aug 27, 2025 •

Copy link
Copy Markdown
Member Author

I confirm it does not add any regressions for #2960 nor #2975 nor #2988

@Kocal
Kocal merged commit 701576e into symfony:2.x Aug 27, 2025
@Kocal
Kocal deleted the fix-livecomponent-url-no-path-params branch August 27, 2025 14:44
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

3 participants