File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed
src/LiveComponent/src/EventListener Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -41,14 +41,14 @@ public function onKernelResponse(ResponseEvent $event): void
4141 return ;
4242 }
4343
44- $ newUrl = null ;
45- if ($ previousLocation = $ request ->headers ->get (self ::URL_HEADER )) {
46- $ liveProps = $ this ->getLivePropsToMap ($ request );
47- $ newUrl = $ this ->urlFactory ->createFromPreviousAndProps ($ previousLocation , $ liveProps ['path ' ], $ liveProps ['query ' ]);
44+ $ newLiveUrl = null ;
45+ if ($ previousLiveUrl = $ request ->headers ->get (self ::URL_HEADER )) {
46+ $ liveProps = $ this ->getLivePropsFromRequest ($ request );
47+ $ newLiveUrl = $ this ->urlFactory ->createFromPreviousAndProps ($ previousLiveUrl , $ liveProps ['path ' ], $ liveProps ['query ' ]);
4848 }
4949
50- if ($ newUrl ) {
51- $ event ->getResponse ()->headers ->set (self ::URL_HEADER , $ newUrl );
50+ if ($ newLiveUrl ) {
51+ $ event ->getResponse ()->headers ->set (self ::URL_HEADER , $ newLiveUrl );
5252 }
5353 }
5454
@@ -59,7 +59,13 @@ public static function getSubscribedEvents(): array
5959 ];
6060 }
6161
62- private function getLivePropsToMap (Request $ request ): array
62+ /**
63+ * @return array{
64+ * path: array<string, mixed>,
65+ * query: array<string, mixed>
66+ * }
67+ */
68+ private function getLivePropsFromRequest (Request $ request ): array
6369 {
6470 $ componentName = $ request ->attributes ->get ('_live_component ' );
6571 $ metadata = $ this ->metadataFactory ->getMetadata ($ componentName );
You can’t perform that action at this time.
0 commit comments