@unsetsoft/ryunixjs 1.2.5-canary.1 → 1.2.5-canary.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.
@@ -1288,14 +1288,12 @@ const useReducer = (reducer, initialState, init, defaultPriority = getCurrentPri
1288
1288
 
1289
1289
  if (!activeRoot) return
1290
1290
 
1291
- currentState.wipRoot = {
1291
+ const newRoot = {
1292
1292
  dom: activeRoot.dom,
1293
1293
  props: activeRoot.props,
1294
1294
  alternate: currentState.currentRoot || null,
1295
1295
  };
1296
- currentState.deletions = [];
1297
- currentState.hookIndex = 0;
1298
- queueUpdate(() => scheduleWork$1(currentState.wipRoot, priority));
1296
+ queueUpdate(() => scheduleWork$1(newRoot, priority));
1299
1297
  };
1300
1298
 
1301
1299
  wipFiber.hooks[hookIndex] = hook;
@@ -2174,6 +2172,21 @@ const updateFunctionComponent = (fiber) => {
2174
2172
  fiber.effectTag = EFFECT_TAGS.HYDRATE;
2175
2173
  }
2176
2174
 
2175
+ // Memo bailout: skip re-render if props haven't changed
2176
+ if (fiber.type._isMemo && fiber.alternate) {
2177
+ const { children: _pc, ...prevRest } = fiber.alternate.props || {};
2178
+ const { children: _nc, ...nextRest } = fiber.props || {};
2179
+ if (fiber.type._arePropsEqual(prevRest, nextRest)) {
2180
+ fiber.hooks = fiber.alternate.hooks;
2181
+ const oldChild = fiber.alternate.child;
2182
+ if (oldChild) {
2183
+ oldChild.parent = fiber;
2184
+ fiber.child = oldChild;
2185
+ }
2186
+ return
2187
+ }
2188
+ }
2189
+
2177
2190
  let children = [fiber.type(fiber.props)];
2178
2191
 
2179
2192
  if (fiber.type._contextId && fiber.props.value !== undefined) {
@@ -3140,18 +3153,12 @@ const renderToStringAsync = async (element, options = {}) => {
3140
3153
  * @returns {Function} Memoized component
3141
3154
  */
3142
3155
  const memo = (Component, arePropsEqual = shallowEqual) => {
3143
- let prevProps = null;
3144
- let prevResult = null;
3145
-
3146
3156
  const MemoizedComponent = (props) => {
3147
- if (prevProps && arePropsEqual(prevProps, props)) {
3148
- return prevResult
3149
- }
3150
- prevProps = props;
3151
- prevResult = Component(props);
3152
- return prevResult
3157
+ return Component(props)
3153
3158
  };
3154
-
3159
+ MemoizedComponent._isMemo = true;
3160
+ MemoizedComponent._wrappedComponent = Component;
3161
+ MemoizedComponent._arePropsEqual = arePropsEqual;
3155
3162
  MemoizedComponent.displayName = `Memo(${Component.displayName || Component.name || 'Component'})`;
3156
3163
  return MemoizedComponent
3157
3164
  };