Skip to content

Commit 35aeef1

Browse files
committed
fix review
1 parent 3b70e2b commit 35aeef1

2 files changed

Lines changed: 29 additions & 24 deletions

File tree

apps/roam/src/components/settings/LeftSidebarPersonalSettings.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ const LeftSidebarPersonalSectionsContent = ({
620620
const addSection = useCallback(
621621
async (sectionName: string) => {
622622
if (!sectionName || !personalSectionUid) return;
623-
if (sections.some((s) => s.text === sectionName)) return;
623+
if (sectionsRef.current.some((s) => s.text === sectionName)) return;
624624

625625
try {
626626
const newBlock = await createBlock({
@@ -636,7 +636,7 @@ const LeftSidebarPersonalSectionsContent = ({
636636
children: undefined,
637637
childrenUid: undefined,
638638
} as LeftSidebarPersonalSectionConfig;
639-
const updatedSections = [...sections, newSection];
639+
const updatedSections = [...sectionsRef.current, newSection];
640640
setSections(updatedSections);
641641
syncAllSectionsToBlockProps(updatedSections);
642642

@@ -653,7 +653,7 @@ const LeftSidebarPersonalSectionsContent = ({
653653
});
654654
}
655655
},
656-
[personalSectionUid, sections],
656+
[personalSectionUid],
657657
);
658658

659659
const handleNewSectionInputChange = useCallback((value: string) => {

apps/roam/src/components/settings/utils/zodSchema.example.ts

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -276,40 +276,43 @@ const defaultGlobalSettings: GlobalSettings = {
276276
};
277277

278278
const personalSection: PersonalSection = {
279+
name: "My Workspace",
279280
Children: [
280-
{ Page: "daily-notes-uid", Alias: "Daily Notes" },
281-
{ Page: "inbox-uid", Alias: "Inbox" },
282-
{ Page: "projects-uid", Alias: "" },
281+
{ uid: "daily-notes-uid", Alias: "Daily Notes" },
282+
{ uid: "inbox-uid", Alias: "Inbox" },
283+
{ uid: "projects-uid", Alias: "" },
283284
],
284285
Settings: {
285286
"Truncate-result?": 100,
286287
Folded: false,
287288
},
288289
};
289290

290-
const leftSidebarPersonalSettings: LeftSidebarPersonalSettings = {
291-
"My Workspace": {
291+
const leftSidebarPersonalSettings: LeftSidebarPersonalSettings = [
292+
{
293+
name: "My Workspace",
292294
Children: [
293-
{ Page: "daily-notes-uid", Alias: "Daily Notes" },
294-
{ Page: "inbox-uid", Alias: "Inbox" },
295+
{ uid: "daily-notes-uid", Alias: "Daily Notes" },
296+
{ uid: "inbox-uid", Alias: "Inbox" },
295297
],
296298
Settings: {
297299
"Truncate-result?": 75,
298300
Folded: false,
299301
},
300302
},
301-
Research: {
303+
{
304+
name: "Research",
302305
Children: [
303-
{ Page: "papers-uid", Alias: "Papers" },
304-
{ Page: "notes-uid", Alias: "Notes" },
305-
{ Page: "ideas-uid", Alias: "Ideas" },
306+
{ uid: "papers-uid", Alias: "Papers" },
307+
{ uid: "notes-uid", Alias: "Notes" },
308+
{ uid: "ideas-uid", Alias: "Ideas" },
306309
],
307310
Settings: {
308311
"Truncate-result?": 50,
309312
Folded: true,
310313
},
311314
},
312-
};
315+
];
313316

314317
const storedFilters: StoredFilters = {
315318
includes: { values: ["Claim", "Evidence"] },
@@ -333,28 +336,30 @@ const querySettings: QuerySettings = {
333336
};
334337

335338
const personalSettings: PersonalSettings = {
336-
"Left sidebar": {
337-
"My Workspace": {
339+
"Left sidebar": [
340+
{
341+
name: "My Workspace",
338342
Children: [
339-
{ Page: "daily-notes-uid", Alias: "Daily Notes" },
340-
{ Page: "inbox-uid", Alias: "Inbox" },
343+
{ uid: "daily-notes-uid", Alias: "Daily Notes" },
344+
{ uid: "inbox-uid", Alias: "Inbox" },
341345
],
342346
Settings: {
343347
"Truncate-result?": 75,
344348
Folded: false,
345349
},
346350
},
347-
Research: {
351+
{
352+
name: "Research",
348353
Children: [
349-
{ Page: "papers-uid", Alias: "Papers" },
350-
{ Page: "notes-uid", Alias: "Notes" },
354+
{ uid: "papers-uid", Alias: "Papers" },
355+
{ uid: "notes-uid", Alias: "Notes" },
351356
],
352357
Settings: {
353358
"Truncate-result?": 50,
354359
Folded: true,
355360
},
356361
},
357-
},
362+
],
358363
"Personal node menu trigger": ";;",
359364
"Node search menu trigger": "//",
360365
"Discourse tool shortcut": "d",
@@ -382,7 +387,7 @@ const personalSettings: PersonalSettings = {
382387
};
383388

384389
const defaultPersonalSettings: PersonalSettings = {
385-
"Left sidebar": {},
390+
"Left sidebar": [],
386391
"Personal node menu trigger": "",
387392
"Node search menu trigger": "",
388393
"Discourse tool shortcut": "",

0 commit comments

Comments
 (0)