@unsetsoft/ryunixjs 1.2.5-canary.2 → 1.2.5-canary.3

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