# Feature: Add flow.$root for simplified access & add a context that allows for state to be only shared within a single node flow/series

**URL:** <https://discourse.nodered.org/t/feature-add-flow-root-for-simplified-access-add-a-context-that-allows-for-state-to-be-only-shared-within-a-single-node-flow-series/19611>\
**Category:** Feature Requests\
**Created:** [26 December 2019 22:28 UTC](https://discourse.nodered.org/t/feature-add-flow-root-for-simplified-access-add-a-context-that-allows-for-state-to-be-only-shared-within-a-single-node-flow-series/19611 "2019-12-26T22:28:21Z")\
**Posts on this page:** 2\
**Page:** 2

<div class="post-metadata">

**Author:** ![niemyjski](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/niemyjski/32/15526_2.png) [@niemyjski](https://discourse.nodered.org/u/niemyjski)\
**Post date:** [29 December 2019 13:07 UTC](https://discourse.nodered.org/t/feature-add-flow-root-for-simplified-access-add-a-context-that-allows-for-state-to-be-only-shared-within-a-single-node-flow-series/19611/21 "2019-12-29T13:07:25Z")

</div>

Id also be more than happy to do a remote session and cover how and why I did this and my pain points current and previously.

I’m pretty naive in my current approach and didn’t fully comprehend flow contexts with messing up that a flow is a tab and not a section and not trying it out before hand.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [29 December 2019 13:22 UTC](https://discourse.nodered.org/t/feature-add-flow-root-for-simplified-access-add-a-context-that-allows-for-state-to-be-only-shared-within-a-single-node-flow-series/19611/22 "2019-12-29T13:22:47Z")

</div>

> [@niemyjski](#):
>
> The first nodes that executes would just create a unique identifier

It doesn't work like that. The identifier needs to be consistent across restarts so that if persistent context is being used then a flow can reattach to its context. As I said in my reply, this is a nontrivial problem.

> [@niemyjski](#):
>
> all nodes in the section would use it/get it passes maybe in a msg header.

If you are passing a context identifier in the message, you may as well pass the information in the message.

> [@niemyjski](#):
>
> I haven’t ran into any issues by returning new message objects. I find it cleaner than to reuse an object,

That's fine, just know it is not the way we recommend users to create their flows. Messages can be rich objects with lots of properties - reusing them is the most efficient way to keep this properties around.

If you have lots of one liner functions just setting message properties, then you should look at the Change node as it'll be more efficient.

[Previous page](https://discourse.nodered.org/t/feature-add-flow-root-for-simplified-access-add-a-context-that-allows-for-state-to-be-only-shared-within-a-single-node-flow-series/19611.md?page=1)
