Context variable not displayed in sidebar when set to undefined

Hi, I have an inject block hooked up to a function block with "global.set('abc', undefined);", and abc never shows up in the context data sidebar. Is undefined not a valid value to use with context?

Correct. Setting it to undefined will delete it from the store.

See this thread: Delete persistent flow context variable It reveals all the secrets of context variable manipulations :slight_smile:

1 Like

Understood, thanks. At first I did not understand why, but I imagine you have value with a default parameter value of undefined -- have to use something in order to do set with no value parameter given. It would be nice to have undefined and have a separate delete method, but a little late for that I imagine -- would break tons of code now.

In your case I would use null to express the fact that the context variable is existing, but has no value set yet.

3 Likes