mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-12-01 21:05:42 +09:00
Merge branch 'main' into pub.staging
This commit is contained in:
9 files changed
+520
-33
No files matched your search
@@ -54,6 +54,42 @@ jobs:
|
||||
- name: Testing cli link command
|
||||
run: pnpm --filter='./fixtures/*' --sequential run fixtures:link
|
||||
|
||||
- name: Wait for Builder deployment
|
||||
shell: bash
|
||||
run: |
|
||||
node --input-type=module <<'NODE'
|
||||
const url = `https://${process.env.BUILDER_HOST}/rest/cli-compatibility`;
|
||||
|
||||
for (let attempt = 1; attempt <= 30; attempt++) {
|
||||
try {
|
||||
const response = await fetch(url, {
|
||||
headers: { "x-webstudio-automation": "webstudio" },
|
||||
signal: AbortSignal.timeout(5_000),
|
||||
});
|
||||
await response.body?.cancel();
|
||||
|
||||
if (response.ok) {
|
||||
console.log(`Builder is ready at ${url}`);
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
console.log(
|
||||
`Builder returned HTTP ${response.status} (attempt ${attempt}/30)`
|
||||
);
|
||||
} catch (error) {
|
||||
console.log(
|
||||
`Builder is not reachable yet (attempt ${attempt}/30): ${error.cause?.code ?? error.message}`
|
||||
);
|
||||
}
|
||||
|
||||
if (attempt < 30) {
|
||||
await new Promise((resolve) => setTimeout(resolve, 5_000));
|
||||
}
|
||||
}
|
||||
|
||||
throw new Error(`Builder did not become ready at ${url} within 5 minutes`);
|
||||
NODE
|
||||
|
||||
- name: Testing cli sync command
|
||||
shell: bash
|
||||
run: |
|
||||
|
||||
@@ -154,6 +154,63 @@ test("convert element instances to lexical", async () => {
|
||||
);
|
||||
});
|
||||
|
||||
test("keeps explicit line break instances while editing", async () => {
|
||||
const { instances } = renderData(
|
||||
<ws.element ws:tag="h3" ws:id="heading">
|
||||
JÄRKI <ws.element ws:tag="br" ws:id="firstBreak" />
|
||||
myyntistrategian <ws.element ws:tag="br" ws:id="secondBreak" />
|
||||
perustukset
|
||||
</ws.element>
|
||||
);
|
||||
const refs: Refs = new Map();
|
||||
const editor = createHeadlessEditor({ nodes: [LinkNode] });
|
||||
await new Promise<void>((resolve) => {
|
||||
editor.update(() => $convertToLexical(instances, "heading", refs), {
|
||||
onUpdate: resolve,
|
||||
});
|
||||
});
|
||||
|
||||
expect(editor.getEditorState().read(() => $getRoot().getTextContent())).toBe(
|
||||
"JÄRKI \nmyyntistrategian \nperustukset"
|
||||
);
|
||||
expect(
|
||||
editor
|
||||
.getEditorState()
|
||||
.read(() =>
|
||||
$convertToUpdates(
|
||||
instances.get("heading")!,
|
||||
refs,
|
||||
new Map(),
|
||||
() => "new"
|
||||
)
|
||||
)
|
||||
).toEqual(Array.from(instances.values()));
|
||||
|
||||
await new Promise<void>((resolve) => {
|
||||
editor.update(
|
||||
() => {
|
||||
$getRoot()
|
||||
.getAllTextNodes()
|
||||
.find((node) => node.getTextContent() === "perustukset")!
|
||||
.setTextContent("new foundations");
|
||||
},
|
||||
{ onUpdate: resolve }
|
||||
);
|
||||
});
|
||||
const updates = editor
|
||||
.getEditorState()
|
||||
.read(() =>
|
||||
$convertToUpdates(instances.get("heading")!, refs, new Map(), () => "new")
|
||||
);
|
||||
expect(updates[0].children).toEqual([
|
||||
{ type: "text", value: "JÄRKI " },
|
||||
{ type: "id", value: "firstBreak" },
|
||||
{ type: "text", value: "myyntistrategian " },
|
||||
{ type: "id", value: "secondBreak" },
|
||||
{ type: "text", value: "new foundations" },
|
||||
]);
|
||||
});
|
||||
|
||||
test("convert lexical to element instances updates", async () => {
|
||||
const refs: Refs = new Map();
|
||||
let nextId = 0;
|
||||
|
||||
@@ -113,7 +113,19 @@ const $writeUpdates = (
|
||||
);
|
||||
}
|
||||
if ($isLineBreakNode(child)) {
|
||||
instanceChildren.push({ type: "text", value: "\n" });
|
||||
const id = refs.get(child.getKey());
|
||||
if (id === undefined) {
|
||||
instanceChildren.push({ type: "text", value: "\n" });
|
||||
} else {
|
||||
instanceChildren.push({ type: "id", value: id });
|
||||
instancesList.push({
|
||||
type: "instance",
|
||||
id,
|
||||
component: elementComponent,
|
||||
tag: "br",
|
||||
children: [],
|
||||
});
|
||||
}
|
||||
}
|
||||
if ($isLinkNode(child)) {
|
||||
const { parentUpdates, formats } = wrapFormats(child);
|
||||
@@ -230,6 +242,13 @@ const $writeLexical = (
|
||||
continue;
|
||||
}
|
||||
|
||||
if (instance.component === elementComponent && instance.tag === "br") {
|
||||
const lineBreakNode = $createLineBreakNode();
|
||||
refs.set(lineBreakNode.getKey(), instance.id);
|
||||
parent.append(lineBreakNode);
|
||||
continue;
|
||||
}
|
||||
|
||||
// convert instances
|
||||
const isLinkInstance =
|
||||
instance.component === "RichTextLink" ||
|
||||
|
||||
@@ -103,6 +103,40 @@ describe("getItems (msw)", () => {
|
||||
expect(result[0].thumbnailAssetName).toBe("thumb.png");
|
||||
});
|
||||
|
||||
test("loads thumbnail names only from their marketplace projects", async () => {
|
||||
server.use(
|
||||
db.get("ApprovedMarketplaceProduct", () =>
|
||||
json([
|
||||
{
|
||||
projectId: "proj-1",
|
||||
marketplaceProduct: marketplaceProductJson,
|
||||
authorizationToken: null,
|
||||
},
|
||||
{
|
||||
projectId: "proj-2",
|
||||
marketplaceProduct: marketplaceProductJson,
|
||||
authorizationToken: null,
|
||||
},
|
||||
])
|
||||
),
|
||||
db.get("Asset", ({ request }) => {
|
||||
expect(new URL(request.url).searchParams.get("or")).toBe(
|
||||
'(and(id.eq."asset-thumb",projectId.eq."proj-1"),and(id.eq."asset-thumb",projectId.eq."proj-2"))'
|
||||
);
|
||||
return json([
|
||||
{ id: "asset-thumb", projectId: "proj-1", name: "first.png" },
|
||||
{ id: "asset-thumb", projectId: "proj-2", name: "second.png" },
|
||||
]);
|
||||
})
|
||||
);
|
||||
|
||||
const result = await getItems(ctx);
|
||||
expect(result.map((item) => item.thumbnailAssetName)).toEqual([
|
||||
"first.png",
|
||||
"second.png",
|
||||
]);
|
||||
});
|
||||
|
||||
test("returns items without thumbnailAssetName when asset missing", async () => {
|
||||
server.use(
|
||||
db.get("ApprovedMarketplaceProduct", () =>
|
||||
|
||||
@@ -55,28 +55,33 @@ export const getItems = async (
|
||||
...parsedProduct.data,
|
||||
});
|
||||
}
|
||||
const assetIds = items
|
||||
.map((item) => item.thumbnailAssetId)
|
||||
.filter((value): value is string => value != null);
|
||||
|
||||
const assets = new Map<string, string>();
|
||||
if (assetIds.length > 0) {
|
||||
if (items.length > 0) {
|
||||
const data = await context.postgrest.client
|
||||
.from("Asset")
|
||||
.select()
|
||||
.in("id", assetIds);
|
||||
.select("id,projectId,name")
|
||||
.or(
|
||||
items
|
||||
.map(
|
||||
(item) =>
|
||||
`and(id.eq.${JSON.stringify(item.thumbnailAssetId)},projectId.eq.${JSON.stringify(item.projectId)})`
|
||||
)
|
||||
.join(",")
|
||||
);
|
||||
if (data.error) {
|
||||
throw data.error;
|
||||
}
|
||||
for (const asset of data.data) {
|
||||
assets.set(asset.id, asset.name);
|
||||
assets.set(`${asset.projectId}:${asset.id}`, asset.name);
|
||||
}
|
||||
}
|
||||
|
||||
return items.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
thumbnailAssetName: assets.get(item.thumbnailAssetId),
|
||||
thumbnailAssetName: assets.get(
|
||||
`${item.projectId}:${item.thumbnailAssetId}`
|
||||
),
|
||||
};
|
||||
});
|
||||
};
|
||||
@@ -2584,23 +2584,19 @@ export const reconcileMdxAuthoredContent = ({
|
||||
}
|
||||
return { ...original, props: normalizedProps, children };
|
||||
}
|
||||
if (expandsToAuthoredChildren) {
|
||||
return {
|
||||
...original,
|
||||
selfClosing: false,
|
||||
props: normalizedProps,
|
||||
children,
|
||||
mdxMode:
|
||||
mode === "text" ||
|
||||
(provenance.editableTextChildren && children.length > 0)
|
||||
? "text"
|
||||
: original.mdxMode,
|
||||
};
|
||||
}
|
||||
return mode === "text" ||
|
||||
(provenance.editableTextChildren && children.length > 0)
|
||||
? { ...original, props: normalizedProps, children, mdxMode: "text" }
|
||||
: { ...original, props: normalizedProps, children };
|
||||
return {
|
||||
...original,
|
||||
...(expandsToAuthoredChildren ? { selfClosing: false } : {}),
|
||||
props: normalizedProps,
|
||||
children,
|
||||
mdxMode:
|
||||
mode === "text" ||
|
||||
(provenance.editableTextChildren &&
|
||||
children.length > 0 &&
|
||||
getInsertedNodeMode(instance.children) === "text")
|
||||
? "text"
|
||||
: original.mdxMode,
|
||||
};
|
||||
}
|
||||
const owningTemplate = templateByExpandedInstanceId.get(instanceId);
|
||||
const isExpandedTemplateDescendant =
|
||||
|
||||
@@ -20,6 +20,7 @@ import {
|
||||
} from "./mdx-materialization";
|
||||
import {
|
||||
materializeMdxAuthoredContent,
|
||||
rebaseMdxAuthoredContent,
|
||||
serializeMdxAuthoredContent,
|
||||
} from "./mdx-authored-content";
|
||||
import {
|
||||
@@ -274,6 +275,169 @@ const getUnresolvedTemplate = (
|
||||
};
|
||||
|
||||
describe("materializeMdxTemplates", () => {
|
||||
test("persists Markdown heading edits inside nested named templates", async () => {
|
||||
const data = createData();
|
||||
const templates = [
|
||||
{ id: "link", name: "ServiceCard", tag: "a" },
|
||||
{ id: "shell", name: "CardShell", tag: "div" },
|
||||
{ id: "text", name: "CardText", tag: "div" },
|
||||
];
|
||||
for (const template of templates) {
|
||||
data.instances.set(template.id, {
|
||||
...template,
|
||||
type: "instance",
|
||||
component: "ws:element",
|
||||
children: [{ type: "text", value: "Template default" }],
|
||||
});
|
||||
}
|
||||
data.instances.get("templates")!.children = templates.map(({ id }) => ({
|
||||
type: "id",
|
||||
value: id,
|
||||
}));
|
||||
const materialize = async (source: string) => {
|
||||
const document = await parseMdxDocument({ source });
|
||||
const templateMaterialization = await materializeMdxTemplates({
|
||||
identity,
|
||||
resolution: resolveMdxTemplates({
|
||||
document,
|
||||
identity,
|
||||
instances: data.instances,
|
||||
metas,
|
||||
}),
|
||||
data,
|
||||
metas,
|
||||
projectId: "target-project",
|
||||
});
|
||||
return materializeMdxAuthoredContent({
|
||||
identity,
|
||||
document,
|
||||
templateMaterialization,
|
||||
});
|
||||
};
|
||||
const root = await materialize(`
|
||||
<ServiceCard href="/services">
|
||||
<CardShell>
|
||||
<CardText>
|
||||
## Before
|
||||
|
||||
Card description
|
||||
</CardText>
|
||||
</CardShell>
|
||||
</ServiceCard>
|
||||
|
||||
<CardText />
|
||||
`);
|
||||
const fragment = structuredClone(root.fragment);
|
||||
const heading = fragment.instances.find(({ tag }) => tag === "h2");
|
||||
expect(heading?.children).toEqual([{ type: "text", value: "Before" }]);
|
||||
heading!.children = [{ type: "text", value: "After" }];
|
||||
|
||||
const next = await rebaseMdxAuthoredContent({
|
||||
root,
|
||||
fragment,
|
||||
latest: root.document,
|
||||
});
|
||||
const reopened = await materialize(serializeMdxDocument(next));
|
||||
|
||||
expect(reopened.document.children).toMatchObject([
|
||||
{
|
||||
name: "ServiceCard",
|
||||
children: [
|
||||
{
|
||||
name: "CardShell",
|
||||
children: [
|
||||
{
|
||||
name: "CardText",
|
||||
children: [
|
||||
{
|
||||
syntax: "markdown",
|
||||
tag: "h2",
|
||||
children: [{ type: "text", value: "After" }],
|
||||
},
|
||||
{ syntax: "markdown", tag: "p" },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{ name: "CardText", selfClosing: true, children: [] },
|
||||
]);
|
||||
expect(
|
||||
reopened.fragment.instances.find(({ tag }) => tag === "h2")?.children
|
||||
).toEqual([{ type: "text", value: "After" }]);
|
||||
});
|
||||
|
||||
test("keeps inline formatting inside a self-closing heading template", async () => {
|
||||
const data = createData();
|
||||
data.instances.set("title", {
|
||||
type: "instance",
|
||||
id: "title",
|
||||
component: "ws:element",
|
||||
tag: "h2",
|
||||
name: "Title",
|
||||
children: [{ type: "text", value: "Bold title" }],
|
||||
});
|
||||
data.instances.get("templates")!.children.push({
|
||||
type: "id",
|
||||
value: "title",
|
||||
});
|
||||
const document = await parseMdxDocument({ source: "<Title />" });
|
||||
const templateMaterialization = await materializeMdxTemplates({
|
||||
identity,
|
||||
resolution: resolveMdxTemplates({
|
||||
document,
|
||||
identity,
|
||||
instances: data.instances,
|
||||
metas,
|
||||
}),
|
||||
data,
|
||||
metas,
|
||||
projectId: "target-project",
|
||||
});
|
||||
const root = materializeMdxAuthoredContent({
|
||||
identity,
|
||||
document,
|
||||
templateMaterialization,
|
||||
});
|
||||
const fragment = structuredClone(root.fragment);
|
||||
const heading = fragment.instances.find(({ tag }) => tag === "h2")!;
|
||||
heading.children = [{ type: "id", value: "strong" }];
|
||||
fragment.instances.push({
|
||||
type: "instance",
|
||||
id: "strong",
|
||||
component: "ws:element",
|
||||
tag: "strong",
|
||||
children: [{ type: "text", value: "Bold title" }],
|
||||
});
|
||||
|
||||
const next = await rebaseMdxAuthoredContent({
|
||||
root,
|
||||
fragment,
|
||||
latest: root.document,
|
||||
});
|
||||
const reopened = await materializeMdxAuthoredContent({
|
||||
identity,
|
||||
document: await parseMdxDocument({
|
||||
source: serializeMdxDocument(next),
|
||||
}),
|
||||
templateMaterialization,
|
||||
});
|
||||
const reopenedHeading = reopened.fragment.instances.find(
|
||||
({ tag }) => tag === "h2"
|
||||
)!;
|
||||
const inlineChildId = reopenedHeading.children.find(
|
||||
(child) => child.type === "id"
|
||||
)?.value;
|
||||
|
||||
expect(
|
||||
reopened.fragment.instances.find(({ id }) => id === inlineChildId)?.tag
|
||||
).toBe("strong");
|
||||
expect(reopened.fragment.instances.map(({ tag }) => tag)).not.toContain(
|
||||
"p"
|
||||
);
|
||||
});
|
||||
|
||||
test.each([
|
||||
["existing source", undefined, "image", true],
|
||||
["existing source, mismatched", undefined, "other-image", false],
|
||||
|
||||
@@ -119,6 +119,133 @@ test("removes orphan folder children from current pages shape", () => {
|
||||
).toEqual(["home"]);
|
||||
});
|
||||
|
||||
test.each(["serialized", "current"])(
|
||||
"repairs page-folder cycles in %s saved data without changing the input",
|
||||
(shape) => {
|
||||
const saved = {
|
||||
homePageId: "home",
|
||||
rootFolderId: "root",
|
||||
pages: [
|
||||
{
|
||||
id: "home",
|
||||
name: "Home",
|
||||
path: "",
|
||||
title: `"Home"`,
|
||||
meta: {},
|
||||
rootInstanceId: "homeRoot",
|
||||
},
|
||||
],
|
||||
folders: [
|
||||
{ id: "b", name: "B", slug: "b", children: ["a"] },
|
||||
{ id: "root", name: "Root", slug: "", children: ["home", "a"] },
|
||||
{ id: "a", name: "A", slug: "a", children: ["b"] },
|
||||
],
|
||||
};
|
||||
const input =
|
||||
shape === "current"
|
||||
? {
|
||||
...saved,
|
||||
pages: new Map(saved.pages.map((page) => [page.id, page])),
|
||||
folders: new Map(
|
||||
saved.folders.map((folder) => [folder.id, folder])
|
||||
),
|
||||
pageTemplates: new Map(),
|
||||
}
|
||||
: saved;
|
||||
|
||||
const recovered = migratePages(input);
|
||||
|
||||
expect(recovered.folders.get("root")?.children).toEqual(["home", "a"]);
|
||||
expect(recovered.folders.get("a")?.children).toEqual(["b"]);
|
||||
expect(recovered.folders.get("b")?.children).toEqual([]);
|
||||
expect(saved.folders[0].children).toEqual(["a"]);
|
||||
expect(() => serializePages(recovered)).not.toThrow();
|
||||
}
|
||||
);
|
||||
|
||||
test("reattaches the root of a detached folder tree containing a cycle", () => {
|
||||
const recovered = migratePages({
|
||||
homePageId: "home",
|
||||
rootFolderId: "root",
|
||||
pages: [
|
||||
{
|
||||
id: "home",
|
||||
name: "Home",
|
||||
path: "",
|
||||
title: `"Home"`,
|
||||
meta: {},
|
||||
rootInstanceId: "homeRoot",
|
||||
},
|
||||
{
|
||||
id: "nested",
|
||||
name: "Nested",
|
||||
path: "/nested",
|
||||
title: `"Nested"`,
|
||||
meta: {},
|
||||
rootInstanceId: "nestedRoot",
|
||||
},
|
||||
],
|
||||
folders: [
|
||||
{ id: "root", name: "Root", slug: "", children: ["home"] },
|
||||
{ id: "a", name: "A", slug: "a", children: ["b"] },
|
||||
{ id: "b", name: "B", slug: "b", children: ["c"] },
|
||||
{ id: "c", name: "C", slug: "c", children: ["b", "nested"] },
|
||||
],
|
||||
});
|
||||
|
||||
expect(recovered.folders.get("root")?.children).toEqual(["home", "a"]);
|
||||
expect(recovered.folders.get("a")?.children).toEqual(["b"]);
|
||||
expect(recovered.folders.get("b")?.children).toEqual(["c"]);
|
||||
expect(recovered.folders.get("c")?.children).toEqual(["nested"]);
|
||||
expect(recovered.pages.has("nested")).toBe(true);
|
||||
expect(() => serializePages(recovered)).not.toThrow();
|
||||
});
|
||||
|
||||
test("still rejects new page-folder cycles when saving", () => {
|
||||
const loaded = migratePages({
|
||||
homePageId: "home",
|
||||
rootFolderId: "root",
|
||||
pages: [
|
||||
{
|
||||
id: "home",
|
||||
name: "Home",
|
||||
path: "",
|
||||
title: `"Home"`,
|
||||
meta: {},
|
||||
rootInstanceId: "homeRoot",
|
||||
},
|
||||
],
|
||||
folders: [
|
||||
{ id: "root", name: "Root", slug: "", children: ["home", "a"] },
|
||||
{ id: "a", name: "A", slug: "a", children: [] },
|
||||
],
|
||||
});
|
||||
loaded.folders.get("a")?.children.push("a");
|
||||
|
||||
expect(() => serializePages(loaded)).toThrow();
|
||||
});
|
||||
|
||||
test("repairs a self-referencing folder in legacy page data", () => {
|
||||
const recovered = migratePages({
|
||||
homePage: {
|
||||
id: "home",
|
||||
name: "Home",
|
||||
path: "",
|
||||
title: `"Home"`,
|
||||
meta: {},
|
||||
rootInstanceId: "homeRoot",
|
||||
},
|
||||
pages: [],
|
||||
folders: [
|
||||
{ id: "root", name: "Root", slug: "", children: ["home", "a"] },
|
||||
{ id: "a", name: "A", slug: "a", children: ["a"] },
|
||||
],
|
||||
});
|
||||
|
||||
expect(recovered.folders.get("a")?.children).toEqual([]);
|
||||
expect(() => serializePages(recovered)).not.toThrow();
|
||||
});
|
||||
|
||||
test("serializes map pages into arrays for JSON storage", () => {
|
||||
expect(
|
||||
serializePages({
|
||||
|
||||
@@ -104,9 +104,10 @@ const isSerializedPages = (pages: unknown): pages is MigratablePages => {
|
||||
);
|
||||
};
|
||||
|
||||
const removeOrphanFolderChildren = (
|
||||
const normalizeFolderChildren = (
|
||||
pages: Map<Page["id"], Page>,
|
||||
folders: Map<Folder["id"], Folder>
|
||||
folders: Map<Folder["id"], Folder>,
|
||||
rootFolderId: Folder["id"]
|
||||
) => {
|
||||
const nextFolders = new Map<Folder["id"], Folder>();
|
||||
for (const [folderId, folder] of folders) {
|
||||
@@ -117,6 +118,49 @@ const removeOrphanFolderChildren = (
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
const visiting = new Set<Folder["id"]>();
|
||||
const visited = new Set<Folder["id"]>();
|
||||
const visit = (folderId: Folder["id"]): boolean => {
|
||||
const folder = nextFolders.get(folderId);
|
||||
if (folder === undefined || visited.has(folderId)) {
|
||||
return false;
|
||||
}
|
||||
visiting.add(folderId);
|
||||
let repaired = false;
|
||||
const children = folder.children.filter((childId) => {
|
||||
if (nextFolders.has(childId) === false) {
|
||||
return true;
|
||||
}
|
||||
if (visiting.has(childId)) {
|
||||
repaired = true;
|
||||
return false;
|
||||
}
|
||||
repaired = visit(childId) || repaired;
|
||||
return true;
|
||||
});
|
||||
nextFolders.set(folderId, { ...folder, children });
|
||||
visiting.delete(folderId);
|
||||
visited.add(folderId);
|
||||
return repaired;
|
||||
};
|
||||
|
||||
// Keep existing paths from the root when choosing which cycle edge to remove.
|
||||
visit(rootFolderId);
|
||||
const referenced = new Set(
|
||||
[...nextFolders.values()].flatMap((folder) => folder.children)
|
||||
);
|
||||
const folderIds = [...nextFolders.keys()].sort();
|
||||
const root = nextFolders.get(rootFolderId);
|
||||
// Visit detached tree roots before isolated cycles, then attach repaired trees.
|
||||
for (const folderId of [
|
||||
...folderIds.filter((id) => referenced.has(id) === false),
|
||||
...folderIds,
|
||||
]) {
|
||||
if (visit(folderId) && root !== undefined) {
|
||||
root.children.push(folderId);
|
||||
}
|
||||
}
|
||||
return nextFolders;
|
||||
};
|
||||
|
||||
@@ -154,9 +198,10 @@ export const migratePages = (pagesData: unknown): Pages => {
|
||||
const normalizedPages = {
|
||||
...currentPages,
|
||||
pageTemplates: currentPages.pageTemplates ?? new Map(),
|
||||
folders: removeOrphanFolderChildren(
|
||||
folders: normalizeFolderChildren(
|
||||
currentPages.pages,
|
||||
currentPages.folders
|
||||
currentPages.folders,
|
||||
currentPages.rootFolderId
|
||||
),
|
||||
};
|
||||
if (hasHistoricalFormComponentIdentityVersion(currentPages)) {
|
||||
@@ -179,7 +224,11 @@ export const migratePages = (pagesData: unknown): Pages => {
|
||||
pagesData.pageTemplates === undefined
|
||||
? new Map()
|
||||
: toMap<PageTemplate>(pagesData.pageTemplates),
|
||||
folders: removeOrphanFolderChildren(nextPages, nextFolders),
|
||||
folders: normalizeFolderChildren(
|
||||
nextPages,
|
||||
nextFolders,
|
||||
pagesData.rootFolderId
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -250,6 +299,6 @@ export const migratePages = (pagesData: unknown): Pages => {
|
||||
rootFolderId: rootFolder.id,
|
||||
pages: nextPages,
|
||||
pageTemplates: new Map(),
|
||||
folders: nextFolders,
|
||||
folders: normalizeFolderChildren(nextPages, nextFolders, rootFolder.id),
|
||||
};
|
||||
};
|
||||
Reference in new issue
Block a user