Skip to content

ENG-1503: Replace getFormattedConfigTree consumers with direct helper calls#860

Merged
sid597 merged 3 commits intomigration-block-init-staging-branchfrom
eng-1503-remove-remnants-of-getformattedconfigtree
Mar 11, 2026
Merged

ENG-1503: Replace getFormattedConfigTree consumers with direct helper calls#860
sid597 merged 3 commits intomigration-block-init-staging-branchfrom
eng-1503-remove-remnants-of-getformattedconfigtree

Conversation

@sid597
Copy link
Collaborator

@sid597 sid597 commented Mar 5, 2026

https://www.loom.com/share/e1bb8573adfe49549013385f6391d21a


Open with Devin

Summary by CodeRabbit

  • Refactor
    • Restructured internal settings access patterns across configuration components, transitioning from legacy config tree retrieval to new helper-based utilities for left sidebar, suggestive mode, export, and general settings management. No user-facing changes; improvements to code maintainability and data flow architecture.

@linear
Copy link

linear bot commented Mar 5, 2026

@supabase
Copy link

supabase bot commented Mar 5, 2026

This pull request has been ignored for the connected project zytfjzqyijgagqxrzbmz because there are no changes detected in packages/database/supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@sid597
Copy link
Collaborator Author

sid597 commented Mar 5, 2026

@coderabbitai full review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 5, 2026

✅ Actions performed

Full review triggered.

Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 5, 2026

📝 Walkthrough

Walkthrough

This pull request refactors settings access patterns across the roam application by systematically replacing direct usage of getFormattedConfigTree with new, specialized helper functions and direct tree access via discourseConfigRef. The changes reorganize how configuration UIDs and values are retrieved and maintain the same behavior through new accessor utilities.

Changes

Cohort / File(s) Summary
Left Sidebar Configuration
apps/roam/src/components/LeftSidebarView.tsx, apps/roam/src/utils/migrateLeftSidebarSettings.ts
Both files transition from getFormattedConfigTree to getLeftSidebarSettings helper for configuration retrieval. Types LeftSidebarConfig and LeftSidebarPersonalSectionConfig are imported from new location ~/utils/getLeftSidebarSettings.
Settings Components
apps/roam/src/components/settings/AdminPanel.tsx, apps/roam/src/components/settings/ExportSettings.tsx, apps/roam/src/components/settings/GeneralSettings.tsx, apps/roam/src/components/settings/SuggestiveModeSettings.tsx
Replace getFormattedConfigTree with new specific helpers (getExportSettingsAndUids, getSuggestiveModeConfigAndUids) and direct discourseConfigRef.tree access. Introduce new utility imports (getPageUidByPageTitle, getUidAndBooleanSetting, getUidAndStringSetting, DISCOURSE_CONFIG_PAGE_TITLE) to compute UID references explicitly.
Core Settings Infrastructure
apps/roam/src/components/settings/Settings.tsx, apps/roam/src/components/settings/utils/accessors.ts
Update configuration node lookups to use discourseConfigRef.tree directly and introduce nullish-aware access patterns. Refactor legacy feature flag readers to use getUidAndBooleanSetting with new tree-based approach.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main objective of the PR: replacing getFormattedConfigTree consumers with direct helper calls, which is reflected across all modified files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot]

This comment was marked as resolved.

@sid597 sid597 requested a review from mdroidian March 6, 2026 05:57
Copy link
Contributor

@mdroidian mdroidian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I won't block on this, but most of these changes look like they use the same functions that getFormattedConfigTree was using. If so, how is this an improvement? I was under the impression the removal of getFormattedConfigTree was to consolidate under dual read. But these changes are effectively the same behavior/logic as previously? It actually seems like these changes will make it more difficult to fully migrate (we'll have to look for many more smaller generic functions, rather than one function)

Can you help me understand what the purpose/benefit of these changes are?

const settings = getFormattedConfigTree();
const exportSettings = settings.export;
const parentUid = settings.export.exportUid;
const exportSettings = getExportSettingsAndUids();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the idea is that depending on how we're going to clean up the functions, if we want to clean up by an individual component, we had to remove getFormattedConfigTree. This is because it could be used on multiple components in a single file but also because we cannot remove just a single. It could be the case that if we move a single key when we're trying to clean up that entire tree of components somewhere else in the repo could use that key, which would then break and go outside of the scope of what we're trying to clean up.

@sid597 sid597 force-pushed the eng-1503-remove-remnants-of-getformattedconfigtree branch from 77d08f3 to 991a7c9 Compare March 11, 2026 10:21
devin-ai-integration[bot]

This comment was marked as resolved.

@sid597 sid597 merged commit cbf7345 into migration-block-init-staging-branch Mar 11, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants