react-refresh 0.17.0-canary-9b62ee71-20250122 → 0.17.0-canary-de1eaa26-20250124

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.
@@ -261,35 +261,68 @@
261
261
  isPerformingRefresh = !0;
262
262
  try {
263
263
  var staleFamilies = new Set(),
264
- updatedFamilies = new Set(),
265
- updates = pendingUpdates;
264
+ update = { updatedFamilies: new Set(), staleFamilies: staleFamilies };
265
+ staleFamilies = pendingUpdates;
266
266
  pendingUpdates = [];
267
- updates.forEach(function (_ref) {
268
- var family = _ref[0];
269
- _ref = _ref[1];
270
- var prevType = family.current;
271
- updatedFamiliesByType.set(prevType, family);
267
+ staleFamilies.forEach(function (_ref) {
268
+ var family = _ref[0],
269
+ nextType = _ref[1];
270
+ _ref = family.current;
272
271
  updatedFamiliesByType.set(_ref, family);
273
- family.current = _ref;
274
- (prevType.prototype && prevType.prototype.isReactComponent) ||
275
- (_ref.prototype && _ref.prototype.isReactComponent)
276
- ? (_ref = !1)
277
- : ((prevType = allSignaturesByType.get(prevType)),
278
- (_ref = allSignaturesByType.get(_ref)),
279
- (_ref =
280
- (void 0 === prevType && void 0 === _ref) ||
281
- (void 0 !== prevType &&
282
- void 0 !== _ref &&
283
- computeFullKey(prevType) === computeFullKey(_ref) &&
284
- !_ref.forceReset)
285
- ? !0
286
- : !1));
287
- _ref ? updatedFamilies.add(family) : staleFamilies.add(family);
272
+ updatedFamiliesByType.set(nextType, family);
273
+ family.current = nextType;
274
+ if (
275
+ (_ref.prototype && _ref.prototype.isReactComponent) ||
276
+ (nextType.prototype && nextType.prototype.isReactComponent) ||
277
+ typeof _ref !== typeof nextType ||
278
+ ("object" === typeof _ref &&
279
+ null !== _ref &&
280
+ null !== nextType &&
281
+ getProperty(_ref, "$$typeof") !==
282
+ getProperty(nextType, "$$typeof"))
283
+ )
284
+ var shouldPreserveState = !1;
285
+ else {
286
+ shouldPreserveState = allSignaturesByType.get(_ref);
287
+ var nextSignature = allSignaturesByType.get(nextType);
288
+ shouldPreserveState =
289
+ (void 0 === shouldPreserveState && void 0 === nextSignature) ||
290
+ (void 0 !== shouldPreserveState &&
291
+ void 0 !== nextSignature &&
292
+ computeFullKey(shouldPreserveState) ===
293
+ computeFullKey(nextSignature) &&
294
+ !nextSignature.forceReset)
295
+ ? !0
296
+ : !1;
297
+ }
298
+ if ("object" === typeof _ref && null !== _ref)
299
+ switch (
300
+ ((nextType = {
301
+ current:
302
+ getProperty(nextType, "$$typeof") === REACT_FORWARD_REF_TYPE
303
+ ? nextType.render
304
+ : getProperty(nextType, "$$typeof") === REACT_MEMO_TYPE
305
+ ? nextType.type
306
+ : nextType
307
+ }),
308
+ getProperty(_ref, "$$typeof"))
309
+ ) {
310
+ case REACT_FORWARD_REF_TYPE:
311
+ updatedFamiliesByType.set(_ref.render, nextType);
312
+ shouldPreserveState
313
+ ? update.updatedFamilies.add(nextType)
314
+ : update.staleFamilies.add(nextType);
315
+ break;
316
+ case REACT_MEMO_TYPE:
317
+ updatedFamiliesByType.set(_ref.type, nextType),
318
+ shouldPreserveState
319
+ ? update.updatedFamilies.add(nextType)
320
+ : update.staleFamilies.add(nextType);
321
+ }
322
+ shouldPreserveState
323
+ ? update.updatedFamilies.add(family)
324
+ : update.staleFamilies.add(family);
288
325
  });
289
- var update = {
290
- updatedFamilies: updatedFamilies,
291
- staleFamilies: staleFamilies
292
- };
293
326
  helpersByRendererID.forEach(function (helpers) {
294
327
  helpers.setRefreshHandler(resolveFamily);
295
328
  });
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "keywords": [
5
5
  "react"
6
6
  ],
7
- "version": "0.17.0-canary-9b62ee71-20250122",
7
+ "version": "0.17.0-canary-de1eaa26-20250124",
8
8
  "homepage": "https://react.dev/",
9
9
  "bugs": "https://github.com/facebook/react/issues",
10
10
  "license": "MIT",