Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const node = getNodeAtPath(mosaicLayout, path);
const before = position === "left" || position === "top";
const [first, second] = before ? [newNode, node] : [node, newNode];
const direction = position === "left" || position === "right" ? "row" : "column";
const updates = [
{
path,
spec: {
$set: { first, second, direction },
},
},
];
if (config.panelConfig) {
savePanelConfig({ id: newNode, config: config.panelConfig, defaultConfig: {} });
}
const newLayout = updateTree(mosaicLayout, updates);
changePanelLayout(newLayout);
};