|
@vardhan30016 Could you explain how this fixes #10912? |
Sorry, something went wrong.
|
@CatchABus Thanks for the question! Here is how this PR fixes #10912: The root issue in #10912 is that when navigating into a component wrapped in a ProxyViewContainer, the page does not receive the expected NavigationEntry.context. page._navigationContext = undefined page.bindingContext = undefined (when no explicit bindingContext was provided) Why this breaks hidden in ProxyViewContainer ProxyViewContainer relies on the final resolved page’s bindingContext to evaluate UI properties such as hidden. This is why the behavior looks inconsistent: the component renders, but reactive properties (hidden, etc.) cannot evaluate without a valid binding context. How this PR fixes it This PR ensures that in all navigation paths, we now forward: entry.context → page._navigationContext entry.context → page.bindingContext And this happens before _onNavigatingTo(), so the page lifecycle receives the correct context. Result With the binding context properly set: ProxyViewContainer receives valid binding state hidden resolves correctly the UI updates as expected the bug in #10912 no longer reproduces This makes navigation context handling consistent and restores correct data-driven UI behavior — including the hidden property. |
Sorry, something went wrong.
|
@vardhan30016 Could you explain how this fixes #10912? @CatchABus Thanks for the question! Here is how this PR fixes #10912: The root issue in #10912 is that when navigating into a component wrapped in a ProxyViewContainer, the page does not receive the expected NavigationEntry.context. page._navigationContext = undefined page.bindingContext = undefined (when no explicit bindingContext was provided) Why this breaks hidden in ProxyViewContainer ProxyViewContainer relies on the final resolved page’s bindingContext to evaluate UI properties such as hidden. This is why the behavior looks inconsistent: the component renders, but reactive properties (hidden, etc.) cannot evaluate without a valid binding context. How this PR fixes it This PR ensures that in all navigation paths, we now forward: entry.context → page._navigationContext entry.context → page.bindingContext And this happens before _onNavigatingTo(), so the page lifecycle receives the correct context. Result With the binding context properly set: ProxyViewContainer receives valid binding state hidden resolves correctly the UI updates as expected the bug in #10912 no longer reproduces This makes navigation context handling consistent and restores correct data-driven UI behavior — including the hidden property. |
Sorry, something went wrong.
|
@vardhan30016 Could you explain how this fixes #10912? @CatchABus Thanks for the question! Here is how this PR fixes #10912: The root issue in #10912 is that when navigating into a component wrapped in a ProxyViewContainer, the page does not receive the expected NavigationEntry.context. Because the context was not forwarded in several navigation flows, the resolved page ended up with: page._navigationContext = undefined page.bindingContext = undefined (when no explicit bindingContext was provided) Why this breaks hidden in ProxyViewContainer ProxyViewContainer relies on the final resolved page’s bindingContext to evaluate UI properties such as hidden. Since the page never received the navigation context, the internal bindings for the template evaluate incorrectly — causing the hidden property to fail. This is why the behavior looks inconsistent: the component renders, but reactive properties (hidden, etc.) cannot evaluate without a valid binding context. How this PR fixes it This PR ensures that in all navigation paths, we now forward: entry.context → page._navigationContext entry.context → page.bindingContext (only when the page does not already have a bindingContext and none was passed explicitly) And this happens before _onNavigatingTo(), so the page lifecycle receives the correct context. Result With the binding context properly set: ProxyViewContainer receives valid binding state hidden resolves correctly the UI updates as expected the bug in #10912 no longer reproduces This makes navigation context handling consistent and restores correct data-driven UI behavior — including the hidden property. This still doesn't look relevant to the missing handling of ProxyViewContainer hiding its children and if you check the issue sample, the author didn't use binding context.
function onNavigatedTo(args) {
var page = args.object;
page.bindingContext = args.context;
}
|
Sorry, something went wrong.
|
@vardhan30016 Could you explain how this fixes #10912? @CatchABus Thanks for the question! Here is how this PR fixes #10912: This still doesn't look relevant to the missing handling of ProxyViewContainer hiding its children and if you check the issue sample, the author didn't use binding context. * Property `bindingContext` is flavor-specific and belongs to plain TS/JS apps. On the contrary, it's something we would ideally decouple from `@nativescript/core` in the next few years.
* Navigation context is general-purpose and users can share literally anything while navigating between pages.
If you want to use the navigation context as binding context, it's up to you as a user to assign it when navigation events are fired.
Example:
function onNavigatedTo(args) {
var page = args.object;
page.bindingContext = args.context;
}
@CatchABus Thanks for the clarification — here is the concise reason this fix is still relevant to #10912: The issue in #10912 happens because the navigation context arrives too late in some navigation flows. When NavigationEntry.context isn’t forwarded early: the Page receives undefined navigation state ProxyViewContainer evaluates before that state is available which produces the inconsistent hidden behavior shown in the issue This PR makes the context consistently available before _onNavigatingTo(), so ProxyViewContainer has the correct state during its evaluation. |
Sorry, something went wrong.
|
Hi @CatchABus — just following up. I've applied all your feedback and clarified the reasoning behind the fix. The issue is not about bindingContext usage by the user — it’s about the The change is fully backward-compatible, touches no public API, and only If everything looks good, could you please review/approve the workflows so it Thanks again for your guidance and time! |
Sorry, something went wrong.
PR Checklist
What is the current behavior?
NavigationEntry.context is not consistently forwarded to the resolved Page during navigation.
In several navigation flows, the context fails to populate:
This causes problems for components and layouts that depend on navigation-based data, including cases like:
What is the new behavior?
During performNavigation():
This fixes missing navigation context data while maintaining full backward compatibility.
Summary of changes
Fixes/Closes #10912.
BREAKING CHANGES
None.
This patch only fills missing context forwarding and does not alter existing APIs or app behavior.