MCPcopy Create free account
hub / github.com/bvaughn/react-resizable-panels / normalizeModel

Function normalizeModel

lib/workspace/models/normalizeModel.ts:23–47  ·  view source on GitHub ↗
(
  model: WorkspaceModelInput<TabData, TabsetData>
)

Source from the content-addressed store, hash-verified

21 * ℹ️ Operations on the workspace's own model copy it themselves, and tidy the copy with normalizeCopiedModel instead.
22 */
23export function normalizeModel<TabData, TabsetData>(
24 model: WorkspaceModelInput<TabData, TabsetData>
25): WorkspaceModel<TabData, TabsetData> {
26 if (model.version !== 1) {
27 if (process.env.NODE_ENV !== "production") {
28 warnOnce(`Unsupported workspace model version: ${model.version}`);
29 }
30 }
31
32 const root = copyAndAssignIds(model.root);
33 const next = normalizeCopiedModel({
34 floating: Array.isArray(model.floating)
35 ? copyAndAssignFloatingIds(model.floating, root)
36 : undefined,
37 maximizedTabsetId: model.maximizedTabsetId,
38 root,
39 version: 1
40 });
41
42 if (process.env.NODE_ENV !== "production") {
43 warnAboutDuplicateIds(next);
44 }
45
46 return next;
47}

Callers 5

WorkspaceComponentFunction · 0.90
createModelFunction · 0.90
floating.test.tsFile · 0.90
normalizeWorkspaceModelFunction · 0.90
model.test.tsFile · 0.90

Calls 5

warnOnceFunction · 0.90
copyAndAssignIdsFunction · 0.90
normalizeCopiedModelFunction · 0.90
copyAndAssignFloatingIdsFunction · 0.90
warnAboutDuplicateIdsFunction · 0.90

Tested by 1

createModelFunction · 0.72