In many cases I see params as null. If the user selects the option for "value1", then sets things and hits done (for that page), then selects the option that goes into href with "value2", it randomly is null, or "value1" passed.
An ugly workaround is to try not to use params, but a separate page for each value, such as:
mainAppPage1()
mainAppPage2()
...
ie one for each possible value of params. This gets ugly quick, and even uglier if params has multiple fields in the map.
Not following,
If you reference the page params after a browser refresh, or after a submitOnChange update they will be null.
In other words, they only exist on the pages initial rendering.
So you load up page 1, said page has an href to page 2, the params being passed to the href are generated on page 1 and passed to page 2.
Page 2 gets the params.
User hits done and is sent back to page 1.
If page 1 now creates a different param value for the href, and the user goes to page 2, those new params will be there.
What you have to do is capture the passed in params map when the page is first called. Only the original call to the page from the href actually has the params present, otherwise they will be null.
Something like this works, where you put the params into state and pull them back out when they are null:
Each invocation of the child page needs its own unique XXXXX identifier (to avoid stepping on each other, right?). But, the child pages share a common template. The template could randomly generate XXXXX, but the value would regenerate on a page refresh.
Yeah, you're going to have a problem disambiguating multiple hrefs. Perhaps you could use a state object to identify which one you're working on. That is, maybe use state instead of params.
Rule Machine (and other apps) have all sorts of contexts like this, where a single href is called to input various things. For example, selecting an action. RM always uses state for this, typically just using a simple counter. That counter is appended to input names, state names, whatever is needed to identify the particular action being worked on.