File tree Expand file tree Collapse file tree
apps/webapp/app/components/primitives Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -70,13 +70,20 @@ function isValidSnapshot(value: unknown): boolean {
7070 if ( it . type !== "panel" ) continue ;
7171 const cv = it . currentValue as Record < string , unknown > | null ;
7272 if ( ! cv || typeof cv !== "object" || cv . type !== "pixel" ) return false ;
73- // value must be numeric (number or numeric string) so prepareSnapshot's
74- // `new Big(value)` rehydration can't throw on us.
75- if ( typeof cv . value !== "string" && typeof cv . value !== "number" ) return false ;
73+ // value must parse as a finite number so prepareSnapshot's
74+ // `new Big(value)` rehydration can't throw — guards against strings
75+ // like "50%" or "" that satisfy typeof but break Big.
76+ if ( ! isFiniteNumeric ( cv . value ) ) return false ;
7677 }
7778 return true ;
7879}
7980
81+ function isFiniteNumeric ( v : unknown ) : boolean {
82+ if ( typeof v === "number" ) return Number . isFinite ( v ) ;
83+ if ( typeof v === "string" && v . trim ( ) !== "" ) return Number . isFinite ( Number ( v ) ) ;
84+ return false ;
85+ }
86+
8087const ResizablePanel = Panel ;
8188
8289const ResizableHandle = ( {
You can’t perform that action at this time.
0 commit comments