MCPcopy
hub / github.com/wavetermdev/waveterm / useTileLayout

Function useTileLayout

frontend/layout/lib/layoutModelHooks.ts:58–70  ·  view source on GitHub ↗
(tabAtom: Atom<Tab>, tileContent: TileLayoutContents)

Source from the content-addressed store, hash-verified

56}
57
58export function useTileLayout(tabAtom: Atom<Tab>, tileContent: TileLayoutContents): LayoutModel {
59 // Use tab data to ensure we can reload if the tab is disposed and remade (such as during Hot Module Reloading)
60 useAtomValue(tabAtom);
61 const layoutModel = useLayoutModel(tabAtom);
62
63 useOnResize(layoutModel?.displayContainerRef, layoutModel?.onContainerResize);
64
65 // Once the TileLayout is mounted, re-run the state update to get all the nodes to flow in the layout.
66 useEffect(() => fireAndForget(() => layoutModel.onTreeStateAtomUpdated(true)), []);
67
68 useEffect(() => layoutModel.registerTileLayout(tileContent), [tileContent]);
69 return layoutModel;
70}
71
72export function useNodeModel(layoutModel: LayoutModel, layoutNode: LayoutNode): NodeModel {
73 return layoutModel.getNodeModel(layoutNode);

Callers 1

TileLayoutComponentFunction · 0.90

Calls 5

useOnResizeFunction · 0.90
fireAndForgetFunction · 0.90
useLayoutModelFunction · 0.85
registerTileLayoutMethod · 0.80

Tested by

no test coverage detected