Skip to content

Commit 27a9985

Browse files
authored
ENG-1765 Persist left-sidebar drag reorders to block prop (#1048)
1 parent 154c7cd commit 27a9985

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

apps/roam/src/components/LeftSidebarView.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import {
3535
mergeGlobalSectionWithAccessor,
3636
mergePersonalSectionsWithAccessor,
3737
} from "~/utils/getLeftSidebarSettings";
38+
import { sectionsToBlockProps } from "./settings/LeftSidebarPersonalSettings";
3839
import discourseConfigRef, { notify } from "~/utils/discourseConfigRef";
3940
import { getLeftSidebarSettings } from "~/utils/getLeftSidebarSettings";
4041
import {
@@ -382,6 +383,10 @@ const PersonalSections = ({
382383
...config,
383384
personal: { ...config.personal, sections: reordered },
384385
});
386+
setPersonalSetting(
387+
[PERSONAL_KEYS.leftSidebar],
388+
sectionsToBlockProps(reordered),
389+
);
385390
void moveRoamBlockToIndex({
386391
blockUid: moved.uid,
387392
parentUid: config.personal.uid,
@@ -414,6 +419,10 @@ const PersonalSections = ({
414419
...config,
415420
personal: { ...config.personal, sections: newSections },
416421
});
422+
setPersonalSetting(
423+
[PERSONAL_KEYS.leftSidebar],
424+
sectionsToBlockProps(newSections),
425+
);
417426
void moveRoamBlockToIndex({
418427
blockUid: child.uid,
419428
parentUid: section.childrenUid,
@@ -704,6 +713,10 @@ const LeftSidebarView = ({
704713
...config,
705714
global: { ...config.global, children: reordered },
706715
});
716+
setGlobalSetting(
717+
[GLOBAL_KEYS.leftSidebar, LEFT_SIDEBAR_KEYS.children],
718+
reordered.map((c) => c.text),
719+
);
707720
void moveRoamBlockToIndex({
708721
blockUid: moved.uid,
709722
parentUid: config.global.childrenUid,

0 commit comments

Comments
 (0)