@unsetsoft/ryunixjs 1.2.5-canary.4 → 1.2.5-canary.6

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.
@@ -1294,14 +1294,12 @@
1294
1294
 
1295
1295
  if (!activeRoot) return
1296
1296
 
1297
- currentState.wipRoot = {
1297
+ const newRoot = {
1298
1298
  dom: activeRoot.dom,
1299
1299
  props: activeRoot.props,
1300
1300
  alternate: currentState.currentRoot || null,
1301
1301
  };
1302
- currentState.deletions = [];
1303
- currentState.hookIndex = 0;
1304
- queueUpdate(() => scheduleWork$1(currentState.wipRoot, priority));
1302
+ queueUpdate(() => scheduleWork$1(newRoot, priority));
1305
1303
  };
1306
1304
 
1307
1305
  wipFiber.hooks[hookIndex] = hook;
@@ -2180,6 +2178,21 @@
2180
2178
  fiber.effectTag = EFFECT_TAGS.HYDRATE;
2181
2179
  }
2182
2180
 
2181
+ // Memo bailout: skip re-render if props haven't changed
2182
+ if (fiber.type._isMemo && fiber.alternate) {
2183
+ const { children: _pc, ...prevRest } = fiber.alternate.props || {};
2184
+ const { children: _nc, ...nextRest } = fiber.props || {};
2185
+ if (fiber.type._arePropsEqual(prevRest, nextRest)) {
2186
+ fiber.hooks = fiber.alternate.hooks;
2187
+ const oldChild = fiber.alternate.child;
2188
+ if (oldChild) {
2189
+ oldChild.parent = fiber;
2190
+ fiber.child = oldChild;
2191
+ }
2192
+ return
2193
+ }
2194
+ }
2195
+
2183
2196
  let children = [fiber.type(fiber.props)];
2184
2197
 
2185
2198
  if (fiber.type._contextId && fiber.props.value !== undefined) {
@@ -3146,18 +3159,12 @@ function $RC(id, templateId) {
3146
3159
  * @returns {Function} Memoized component
3147
3160
  */
3148
3161
  const memo = (Component, arePropsEqual = shallowEqual) => {
3149
- let prevProps = null;
3150
- let prevResult = null;
3151
-
3152
3162
  const MemoizedComponent = (props) => {
3153
- if (prevProps && arePropsEqual(prevProps, props)) {
3154
- return prevResult
3155
- }
3156
- prevProps = props;
3157
- prevResult = Component(props);
3158
- return prevResult
3163
+ return Component(props)
3159
3164
  };
3160
-
3165
+ MemoizedComponent._isMemo = true;
3166
+ MemoizedComponent._wrappedComponent = Component;
3167
+ MemoizedComponent._arePropsEqual = arePropsEqual;
3161
3168
  MemoizedComponent.displayName = `Memo(${Component.displayName || Component.name || 'Component'})`;
3162
3169
  return MemoizedComponent
3163
3170
  };