({
encoded,
searchParams
}: {
encoded: string;
searchParams: URLSearchParams;
})
| 15 | import { decode } from "../utils/serializer/decode"; |
| 16 | |
| 17 | export function Decoder({ |
| 18 | encoded, |
| 19 | searchParams |
| 20 | }: { |
| 21 | encoded: string; |
| 22 | searchParams: URLSearchParams; |
| 23 | }) { |
| 24 | const [group, setGroup] = useGroupCallbackRef(); |
| 25 | const groupRef = useGroupRef(); |
| 26 | const groupRefProp = searchParams.has("useGroupCallbackRef") |
| 27 | ? setGroup |
| 28 | : searchParams.has("useGroupRef") |
| 29 | ? groupRef |
| 30 | : undefined; |
| 31 | |
| 32 | const [panel, setPanel] = usePanelCallbackRef(); |
| 33 | const panelRef = usePanelRef(); |
| 34 | const panelRefProp = searchParams.has("usePanelCallbackRef") |
| 35 | ? setPanel |
| 36 | : searchParams.has("usePanelRef") |
| 37 | ? panelRef |
| 38 | : undefined; |
| 39 | |
| 40 | const [cursorData, setCursorData] = useState<{ |
| 41 | cursorStyle: string; |
| 42 | movementX: number; |
| 43 | movementY: number; |
| 44 | }>({ |
| 45 | cursorStyle: "", |
| 46 | movementX: 0, |
| 47 | movementY: 0 |
| 48 | }); |
| 49 | |
| 50 | const stableCallbacksRef = useRef<{ |
| 51 | readGroupLayout: () => void; |
| 52 | readPanelSize: () => void; |
| 53 | }>({ |
| 54 | readGroupLayout: () => {}, |
| 55 | readPanelSize: () => {} |
| 56 | }); |
| 57 | useLayoutEffect(() => { |
| 58 | stableCallbacksRef.current.readGroupLayout = () => { |
| 59 | const imperativeGroupApiLayout = |
| 60 | group?.getLayout() ?? groupRef.current?.getLayout(); |
| 61 | if (imperativeGroupApiLayout) { |
| 62 | setState((prevState) => ({ ...prevState, imperativeGroupApiLayout })); |
| 63 | } |
| 64 | }; |
| 65 | stableCallbacksRef.current.readPanelSize = () => { |
| 66 | const imperativePanelApiSize = |
| 67 | panel?.getSize() ?? panelRef.current?.getSize(); |
| 68 | if (imperativePanelApiSize) { |
| 69 | setState((prevState) => ({ ...prevState, imperativePanelApiSize })); |
| 70 | } |
| 71 | }; |
| 72 | }); |
| 73 | |
| 74 | const [gridState, setGridState] = useState<{ |
nothing calls this directly
no test coverage detected