@unsetsoft/ryunixjs 0.2.26-nightly.10 → 0.2.26-nightly.12

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.
Files changed (2) hide show
  1. package/lib/dom.js +11 -10
  2. package/package.json +1 -1
package/lib/dom.js CHANGED
@@ -435,7 +435,7 @@ function createContext(defaultValue) {
435
435
  let contextValue = defaultValue || null;
436
436
 
437
437
  const context = {
438
- tag: "RYUNIX_CREATE_CONTEXT",
438
+ tag: "RYUNIX_CONTEXT",
439
439
  Value: contextValue,
440
440
  Provider: null,
441
441
  };
@@ -448,21 +448,22 @@ function createContext(defaultValue) {
448
448
  // Hooks
449
449
 
450
450
  function useContext(ref) {
451
- const Context = oldHook ? oldHook : ref;
452
-
453
- const hook = {
454
- tag: "RYUNIX_USE_CONTEXT",
455
- __context: Context,
456
- };
457
-
458
- wipFiber.hooks.push(hook);
459
451
  hookIndex++;
452
+
460
453
  const oldHook =
461
454
  wipFiber.alternate &&
462
455
  wipFiber.alternate.hooks &&
463
456
  wipFiber.alternate.hooks[hookIndex];
464
457
 
465
- return hook.__context.Value;
458
+ const hasOld = oldHook ? oldHook : undefined;
459
+ const Context = hasOld ? hasOld : ref;
460
+ const hook = {
461
+ ...Context,
462
+ };
463
+
464
+ wipFiber.hooks.push(hook);
465
+
466
+ return hook.Value;
466
467
  }
467
468
 
468
469
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unsetsoft/ryunixjs",
3
- "version": "0.2.26-nightly.10",
3
+ "version": "0.2.26-nightly.12",
4
4
  "license": "MIT",
5
5
  "main": "./dist/Ryunix.js",
6
6
  "private": false,