Variables, New-UDDynamic and Environments

I would suggest avoiding the use of $temp, global and session variable scopes for dashboards because of how runspaces are reused.

The persistent runspaces provide no guarantees that the runspace will be reused by the same user. Like you’ve seen, weird things can happen when viewing two pages at once since those variables were set during different executions. It will get even more weird the more the users connect. With non-persistent runspaces, the runspace state is reset every time the runspace is reused. I’m really surprised the global scope continues to work in some circumstances when your environment is configured like this.

Session variables are consistent but only for the session and not for the page in general. I do think that some sort of page-based variable scope may be useful for this reason.

I know some users that will create variables that are named specific to the page they are using:

$Session:Page1_Id = "Something" 

For a dynamic page like your example, you may want to consider using a different type of object that can store dynamic keys.

New-UDPage -Url /test/:id -Content {
    if (-not $Session:Data)
         $Session:Data = @{} 

    $Session:Data[$Id] = "Some value"