MCPcopy Create free account
hub / github.com/RtlZeroMemory/Rezi / diagWhichPropFails

Function diagWhichPropFails

packages/core/src/runtime/commit/equality.ts:472–569  ·  view source on GitHub ↗
(prev: VNode, next: VNode)

Source from the content-addressed store, hash-verified

470}
471
472export function diagWhichPropFails(prev: VNode, next: VNode): string | undefined {
473 if (prev.kind !== next.kind) return "kind";
474 type ReuseDiagProps = {
475 style?: unknown;
476 inheritStyle?: unknown;
477 key?: unknown;
478 [key: string]: unknown;
479 };
480 const ap = (prev.props ?? {}) as ReuseDiagProps;
481 const bp = (next.props ?? {}) as ReuseDiagProps;
482 if (prev.kind === "fragment" && ap.key !== bp.key) {
483 return "key";
484 }
485 if (prev.kind === "row" || prev.kind === "column") {
486 for (const k of ["pad", "gap", "align", "justify", "items"] as const) {
487 if (ap[k] !== bp[k]) return k;
488 }
489 if (
490 !textStyleEqual(
491 ap.style as Parameters<typeof textStyleEqual>[0],
492 bp.style as Parameters<typeof textStyleEqual>[0],
493 )
494 )
495 return "style";
496 if (
497 !textStyleEqual(
498 ap.inheritStyle as Parameters<typeof textStyleEqual>[0],
499 bp.inheritStyle as Parameters<typeof textStyleEqual>[0],
500 )
501 )
502 return "inheritStyle";
503 for (const k of [
504 "width",
505 "height",
506 "minWidth",
507 "maxWidth",
508 "minHeight",
509 "maxHeight",
510 "flex",
511 "aspectRatio",
512 ] as const) {
513 if (ap[k] !== bp[k]) return k;
514 }
515 for (const k of [
516 "p",
517 "px",
518 "py",
519 "pt",
520 "pb",
521 "pl",
522 "pr",
523 "m",
524 "mx",
525 "my",
526 "mt",
527 "mr",
528 "mb",
529 "ml",

Callers 1

commitContainerFunction · 0.85

Calls 1

textStyleEqualFunction · 0.85

Tested by

no test coverage detected