Hi,
This question is about UD 2.9.1.
Not that I’ve really used any custom functions inside my endpoints - other than those passed in through endpoint initialization -functions and -modules params.
But I wanted to just question and understand some behaviour I’m seeing and wondered if this was by design or not.
If I create two test pages as -endpoint pages.
The variables between them are isolated and not addressable from either page.
However I’ve found that if I write a simple function on one of the pages:
function hello-world {
new-udhtml -markup "hello world"
}
and call it on the other page it works (at least sometimes in my testing).
Is this because both endpoints (at the time I’m able to bleed my function across to the other page), are in the same shared runspace pool?
I used a lot of functions in UD, but I place each function in their separate PS files and load them in my dashboard. I use these functions normally for long codes, button in a huge udgrid / udtable data or frequently used request.
Never tested with function in pages though. I think I read it somewhere where I believe adam make some changes to how function behave in UD awhile back (not required to be initialized in endpoint), where it’s accessible across pages.
This is a little strange. We do use a runspace pool but for every endpoint execution we run ResetRunspace on that runspace. I would have imagined it would set the runspace back to the initial session state but maybe it’s not cleaning functions properly.
I find that very surprising and think it could be a bug in PS.