@lukekaalim/act-recon 1.1.1 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @lukekaalim/act-recon
2
2
 
3
+ ## 1.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - e2f7db4: Fix context hooks not properly incrementing their hookIndex, causing the same value to be returned for each subsequent useContext call
8
+
3
9
  ## 1.1.1
4
10
 
5
11
  ### Patch Changes
package/hooks.ts CHANGED
@@ -24,10 +24,11 @@ export const loadHooks = (
24
24
  ) => {
25
25
  let index = 0;
26
26
  hookImplementation.useContext = <T>(context: Context<T>): T => {
27
- let value = state.contexts.get(index);
27
+ const stateIndex = index++;
28
+ let value = state.contexts.get(stateIndex);
28
29
  if (!value) {
29
30
  value = { state: findContext(contexts, ref, context) };
30
- state.contexts.set(index, value);
31
+ state.contexts.set(stateIndex, value);
31
32
  if (value.state)
32
33
  value.state.consumers.set(ref.id, ref);
33
34
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lukekaalim/act-recon",
3
3
  "type": "module",
4
- "version": "1.1.1",
4
+ "version": "1.1.2",
5
5
  "main": "mod.ts",
6
6
  "dependencies": {
7
7
  "@lukekaalim/act": "^3.1.0"