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