Been having some trouble with something that seems like it really shouldn’t be difficult.
We have a perspective project that utilizes a parameter specified in the URL. For the main views on pages this works as expected. But there doesn’t appear to be an easy way to get that parameter for docked views however. I can try to use the page.props.pagePath, but if the user goes and changes the URL manually, or opens a bookmark, it seems to me there is a bug where it gives the previous page path.
So here’s what I’m doing right now:
- Navigate to a page; the main view and docked view start.
- On the startup script of my docked window, I send a message to the main view saying “I’m open now and running”.
- The Main view on that page receives the message, and then sends a 2nd message saying “this is the parameter from the url”.
- then the docked window can now run a script to load things in based on the parameter, now that I know that both views are running/responding. (In this script it tells the main view a bunch of information through another message).
This all assumes that docked views will always start after main views. If it’s random, or just that my main view happens to be finishing first, then potentially this could all break down if the docked view happens to start first (because the main view isn’t fully running yet and won’t receive the message).
We cannot use a session property, because a user might have 3 or 4 pages open at the same time, with different parameters in the url to look at totally different things.
Is there a better way? It’s very weird to me that docked views can’t get the URL parameter in the same manner as main views.