Skip to content

Commit 4526455

Browse files
committed
fix(help): webview source not updating
1 parent 1d259aa commit 4526455

File tree

4 files changed

+26
-2
lines changed

4 files changed

+26
-2
lines changed

apps/server/src/assets/doc_notes/en/User Guide/!!!meta.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/server/src/services/hidden_subtree.spec.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,21 @@ describe("Hidden Subtree", () => {
9898
expect(updatedBoardTemplate?.title).not.toBe("My renamed board");
9999
});
100100

101+
it("enforces webviewSrc of templates", () => {
102+
const apiRefNote = becca.getNote("_help_9qPsTWBorUhQ");
103+
expect(apiRefNote).toBeDefined();
104+
105+
cls.init(() => {
106+
apiRefNote!.setAttribute("label", "webViewSrc", "foo");
107+
apiRefNote!.save();
108+
hiddenSubtreeService.checkHiddenSubtree(true);
109+
});
110+
111+
const updatedApiRefNote = becca.getNote("_help_9qPsTWBorUhQ");
112+
expect(updatedApiRefNote).toBeDefined();
113+
expect(updatedApiRefNote?.getLabelValue("webViewSrc")).not.toBe("foo");
114+
});
115+
101116
it("maintains launchers hidden, if they were shown by default but moved by the user", () => {
102117
const launcher = becca.getNote("_lbLlmChat");
103118
const branch = launcher?.getParentBranches()[0];

apps/server/src/services/hidden_subtree.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,8 +451,16 @@ function checkHiddenSubtreeRecursively(parentNoteId: string, item: HiddenSubtree
451451
// Enforce attribute structure if needed.
452452
if (item.enforceAttributes) {
453453
for (const attribute of note.getAttributes()) {
454-
if (!attrs.some(a => a.name === attribute.name)) {
454+
// Remove unwanted attributes.
455+
const attrDef = attrs.find(a => a.name === attribute.name);
456+
if (!attrDef) {
455457
attribute.markAsDeleted();
458+
continue;
459+
}
460+
461+
// Ensure value is consistent.
462+
if (attribute.value !== attrDef.value) {
463+
note.setAttributeValueById(attribute.attributeId, attrDef.value);
456464
}
457465
}
458466
}

apps/server/src/services/in_app_help.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ export function parseNoteMeta(noteMeta: NoteMeta, docNameRoot: string): HiddenSu
7878
// Handle web views
7979
if (noteMeta.type === "webView") {
8080
item.type = "webView";
81+
item.enforceAttributes = true;
8182
}
8283

8384
// Handle children

0 commit comments

Comments
 (0)