If I put the same PV name on two different pages, are they sharing some global namespace, but are filtered in the UI?
I ask because the debug view shows PV Names from all of the pages. Also, when you enter a new PV name, you see matches as you type that are from different pages.
The context here is that I have a PV named “Page_Error” and others that I have standardized to be on each page. I don’t want the values of Page_Error (e.g.) from page A to show up when I switch to Page B
I’m seeing not all page vars at once, but only for those pages that I’ve visited. In other words, once I visit a page, that page’s vars are shown in the debugger, even if I leave the page. So once you visit all your pages, yes, all the page vars will now show in the debugger. I think this is just a bug in the debugger (how ironic). I don’t think there is any namespace confusion in the app itself.
Thanks, Marty. Another helpful answer! I hadn’t noticed that behaviour in the debugger. That kind of bug would explain most of the confusion I have seen. I will check that out. I’d still like to confirm that the PVs are isolated so that I can feel confidant that the same name used in 2 or more pages isn’t sharing the same value in memory.
Hi Fraser. I’m certain from my experience (and from the AppGyver docs) that the pageVars are isolated to the single page, regardless of the naming convention. The debugger is a little confusing to read when you give both variables the same name in that is looks like the only thing changing when you navigate to a new page is the value, but they are different. The first pageVar value stays in the stack with the page, and gets destroyed when the page leaves the stack (in this case, when the app closes). The debugger doesn’t show stack actions in the STATE tab, or in the FLOWS (well it sort of does I guess, if you track the page mount events, but not the point ).
You can test this by:
- setting up your pageVars on two pages with different initial values
- adding a button to change the value on page 2 (or however else you want to change the value).
- In the preview, open on page 1 to see the first pageVar displayed .
- then navigate to page 2. The debugger will still show the construction of the page 2 pageVar. Click the change button and see the value change in the debugger.
- go back to page 1, which will retrieve the it from the stack. Your page 1 pageVar is still its original value.
I guess that’s just a long way of saying “trust me, its fine”
Great answer, Bryan! (@BryanB)
Between you and @Marty_Flickinger, I think my question is solved. I wish I could mark you both as providing the solution.