# ContextStore.delete & ContextStore.clean

**URL:** <https://discourse.nodered.org/t/contextstore-delete-contextstore-clean/95178>\
**Category:** Developing Nodes\
**Created:** [6 February 2025 11:04 UTC](https://discourse.nodered.org/t/contextstore-delete-contextstore-clean/95178 "2025-02-06T11:04:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ziga](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ziga/32/98138_2.png) [@ziga](https://discourse.nodered.org/u/ziga)\
**Post date:** [6 February 2025 11:04 UTC](https://discourse.nodered.org/t/contextstore-delete-contextstore-clean/95178/1 "2025-02-06T11:04:52Z")

</div>

I'm looking into custom context storage and for that, one needs to implement an interface described [here](https://nodered.org/docs/api/context/methods/#contextstorekeysscope-callback).

I'm wondering when are `ContextStore.delete` and `ContextStore.clean` actually called so I can reproduce and test this.

---

<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:** [6 February 2025 11:06 UTC](https://discourse.nodered.org/t/contextstore-delete-contextstore-clean/95178/2 "2025-02-06T11:06:06Z")

</div>

Clean is called when new flows are deployed - it allows the store to clean up any context records for nodes/flows no longer present.

Delete is called when a user deletes a context object - can be triggered by the context sidebar in the editor.

---

<div class="post-metadata">

**Author:** ![ziga](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ziga/32/98138_2.png) [@ziga](https://discourse.nodered.org/u/ziga)\
**Post date:** [6 February 2025 11:16 UTC](https://discourse.nodered.org/t/contextstore-delete-contextstore-clean/95178/3 "2025-02-06T11:16:59Z")

</div>

> [@knolleary](#):
>
> Clean is called when new flows are deployed - it allows the store to clean up any context records for nodes/flows no longer present.

This I can confirm, ty.

> [@knolleary](#):
>
> Delete is called when a user deletes a context object - can be triggered by the context sidebar in the editor.

In the sidebar I only found a way to delete individual keys but that is calling `ContextStore.set` with `undefined` value in the background.  
I haven't seem to be able to delete whole `flow` context for example from that sidebar.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [7 April 2025 11:17 UTC](https://discourse.nodered.org/t/contextstore-delete-contextstore-clean/95178/4 "2025-04-07T11:17:22Z")

</div>

Closed on 7 April 2025 11:17 UTC

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
