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
41
41
return ;
42
42
}
43
43
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 ' ]);
48
48
}
49
49
50
- if ($ newUrl ) {
51
- $ event ->getResponse ()->headers ->set (self ::URL_HEADER , $ newUrl );
50
+ if ($ newLiveUrl ) {
51
+ $ event ->getResponse ()->headers ->set (self ::URL_HEADER , $ newLiveUrl );
52
52
}
53
53
}
54
54
@@ -59,7 +59,13 @@ public static function getSubscribedEvents(): array
59
59
];
60
60
}
61
61
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
63
69
{
64
70
$ componentName = $ request ->attributes ->get ('_live_component ' );
65
71
$ metadata = $ this ->metadataFactory ->getMetadata ($ componentName );
You can’t perform that action at this time.
0 commit comments