fix: expose upcoming navigation target via routerStateSignal during chain construction#24472
fix: expose upcoming navigation target via routerStateSignal during chain construction#24472Artur- wants to merge 1 commit into
Conversation
…hain construction Updates routerStateSignal in AbstractNavigationStateRenderer.handle() before the new layout/view chain is instantiated, so code running in constructors (e.g. a Signal.map() bound via bindText) sees the upcoming location, route parameters and navigationTarget instead of the previous state. Previously the signal was only refreshed in handleAfterNavigationEvents, after construction, causing reactive mappings on navigationTarget() to NPE during the ElementEffect probe. Fixes #24471
|
|
Is this wrong aka it updates the info too early? Should it only be done for the first navigation to avoid that navigationTarget can ever be null? Should it not be done at all? |
|
I'm not 100% sure about this being a fix for an issue or a new feature.
On the other hand, I would either not apply any change, since the case is documented, or do an early update for the first navigation only, but making it explicit by using a |
|
I don't think the signal should work differently though - it should be in sync with the router state so no matter how you access the router state in a constructor, it should be the same |



Updates routerStateSignal in AbstractNavigationStateRenderer.handle() before the new layout/view chain is instantiated, so code running in constructors (e.g. a Signal.map() bound via bindText) sees the upcoming location, route parameters and navigationTarget instead of the previous state. Previously the signal was only refreshed in handleAfterNavigationEvents, after construction, causing reactive mappings on navigationTarget() to NPE during the ElementEffect probe.
Fixes #24471