You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This document demonstrates the successful implementation of the JsSlangContextStore that moves js-slang evaluation contexts out of Redux.
4
+
5
+
## Problem Solved
6
+
7
+
The original implementation stored mutable js-slang `Context` objects directly in Redux state, which violated Redux's immutability requirements and caused issues with Immer's auto-freezing behavior.
8
+
9
+
## Solution
10
+
11
+
We created a global singleton store that manages js-slang contexts outside of Redux:
12
+
13
+
### Core Components
14
+
15
+
1.**JsSlangContextStore** - Global Map-based store with UUID keys
16
+
2.**Context Store Functions** - `putJsSlangContext()`, `getJsSlangContext()`, `deleteJsSlangContext()`
17
+
3.**React Hook** - `useJsSlangContext()` for transparent context access
18
+
4.**Type Changes** - `context: Context` → `contextId: string` in Redux state
0 commit comments