Ya, and that makes sense as to why the onstartup is behaving the way it does…and that explains why I got the “it’s working as designed” when I’ve asked about it in the past.
My complaint is that, even if a parameter change doesn’t ‘technically’ constitute a page change, in ‘practice’ it does…especially the way parameterization is implemented…the actual url is changing, not just the query string. I have twelve filters and when I navigate between them the expected behavior is that they are separate pages (whether that’s technically true or not). Obviously I could create twelve pages, but that’s silly.
As a work around, is there no way to know when the URL has changed?
Thanks @pturmel. I have, and it does work…and that is my current fallback plan. The issue there is that not all of my pages have the same params so I’m looking for a more general solution so that every page works the same way. Another fallback (I’ve not tried yet) is putting a message handler on a view that always exists (header for example), and then send a ‘navigate’ message as my standard method of navigation.
After further testing, the navigate message won’t work for a couple of reasons. The parameter onchange script approach seems to be the only way, but also is not a complete solution because it turns out that it doesn’t always fire either. Using a combination of onStartup and onChange script on a page parameter seems to cover all navigation scenarious (that I’m using anyway), but it’s definitely a dodgy way to do it.
We need an event that fires for any kind of navigation.
Finally, I found the work around I’ve been asking for…I don’t know why this was so hard. Obviously the best solution would be an event that’s prebuilt into every page. In lieu of that, monitoring the URL seems like the next best thing.
On my header view (shown on all pages) I added a custom attribute and mapped it to page.props.path…an onchange script on that custom attribute fires any time navigation occurs regardless of parameterized pages. From there I’ll send a ‘page loaded’ message and anything that cares can consume it.