Skip to content

ENG-1272 Migrate all small global settings components#688

Open
sid597 wants to merge 6 commits intomainfrom
eng-1272-migrate-all-small-global-settings-component
Open

ENG-1272 Migrate all small global settings components#688
sid597 wants to merge 6 commits intomainfrom
eng-1272-migrate-all-small-global-settings-component

Conversation

@sid597
Copy link
Collaborator

@sid597 sid597 commented Jan 12, 2026

@linear
Copy link

linear bot commented Jan 12, 2026

@supabase
Copy link

supabase bot commented Jan 12, 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 sid597 force-pushed the eng-1274-add-feature-flags-in-settings branch from 29817b9 to 9cd0a2c Compare January 12, 2026 15:26
@sid597 sid597 force-pushed the eng-1272-migrate-all-small-global-settings-component branch from 8f1c13c to 2d2bb77 Compare January 12, 2026 15:26
@sid597 sid597 marked this pull request as ready for review January 12, 2026 15:27
@sid597 sid597 force-pushed the eng-1272-migrate-all-small-global-settings-component branch from 2d2bb77 to f9de2fd Compare January 12, 2026 15:38
@sid597 sid597 force-pushed the eng-1272-migrate-all-small-global-settings-component branch from d1b8faf to 9015611 Compare January 17, 2026 18:16
@sid597 sid597 force-pushed the eng-1274-add-feature-flags-in-settings branch 2 times, most recently from 23cedec to 496a3ba Compare January 18, 2026 05:25
@sid597 sid597 force-pushed the eng-1272-migrate-all-small-global-settings-component branch 2 times, most recently from 16b26f7 to dd2272b Compare January 19, 2026 04:51
@sid597 sid597 force-pushed the eng-1274-add-feature-flags-in-settings branch 2 times, most recently from 0238148 to 8dbd24c Compare January 19, 2026 05:01
@sid597 sid597 force-pushed the eng-1272-migrate-all-small-global-settings-component branch from dd2272b to 92ea54b Compare January 19, 2026 05:01
@sid597 sid597 force-pushed the eng-1274-add-feature-flags-in-settings branch from 8dbd24c to 4c71862 Compare January 19, 2026 06:03
@sid597 sid597 force-pushed the eng-1272-migrate-all-small-global-settings-component branch from 92ea54b to 5a165ac Compare January 19, 2026 06:03
@sid597 sid597 force-pushed the eng-1274-add-feature-flags-in-settings branch from 4c71862 to 77d1c95 Compare January 19, 2026 06:34
@sid597 sid597 force-pushed the eng-1272-migrate-all-small-global-settings-component branch from 97aa080 to 443ab86 Compare February 3, 2026 19:08
@sid597 sid597 force-pushed the graphite-base/688 branch from fcfa83f to c022156 Compare February 3, 2026 19:08
@sid597 sid597 changed the base branch from graphite-base/688 to eng-1345-modify-existing-roamjs-component-onchange-to-also-change February 3, 2026 19:08
Copy link

@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 found 2 new potential issues.

View issues and 9 additional flags in Devin Review.

Open in Devin Review

@sid597 sid597 force-pushed the eng-1272-migrate-all-small-global-settings-component branch 3 times, most recently from 70cccaf to a70854f Compare February 3, 2026 20:05
@sid597 sid597 changed the base branch from eng-1345-modify-existing-roamjs-component-onchange-to-also-change to graphite-base/688 February 4, 2026 17:17
@sid597 sid597 force-pushed the graphite-base/688 branch from c022156 to cf56730 Compare February 4, 2026 17:56
@sid597 sid597 force-pushed the eng-1272-migrate-all-small-global-settings-component branch from a70854f to 94e3904 Compare February 4, 2026 17:56
@sid597 sid597 changed the base branch from graphite-base/688 to eng-1345-modify-existing-roamjs-component-onchange-to-also-change February 4, 2026 17:57
Copy link

@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 found 1 potential issue.

View issue and 4 additional flags in Devin Review.

Open in Devin Review

@sid597 sid597 changed the base branch from eng-1345-modify-existing-roamjs-component-onchange-to-also-change to graphite-base/688 February 4, 2026 18:05
@sid597 sid597 force-pushed the eng-1272-migrate-all-small-global-settings-component branch from 94e3904 to fbede09 Compare February 6, 2026 18:59
@sid597 sid597 force-pushed the graphite-base/688 branch from cf56730 to 2ac769a Compare February 6, 2026 18:59
@sid597 sid597 changed the base branch from graphite-base/688 to main February 6, 2026 18:59
Copy link

@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 found 1 new potential issue.

View 6 additional findings in Devin Review.

Open in Devin Review

Comment on lines +128 to 131
setTimeout(() => {
console.log(`[TextPanel] "${title}" after set, blockProp:`, getter(settingKeys));
}, 500);
};

Choose a reason for hiding this comment

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

🟡 Debug console.log statements left in production code

Multiple debug console.log statements were added inside setTimeout callbacks throughout the BlockPropSettingPanels.tsx file. These appear to have been added for testing purposes (per commit message "add comments for testing") but should be removed before production.

Affected Locations

The debug statements appear at:

  • apps/roam/src/components/settings/components/BlockPropSettingPanels.tsx:128-130 (BaseTextPanel)
  • apps/roam/src/components/settings/components/BlockPropSettingPanels.tsx:201-203 (BaseFlagPanel)
  • apps/roam/src/components/settings/components/BlockPropSettingPanels.tsx:254-256 (BaseNumberPanel)
  • apps/roam/src/components/settings/components/BlockPropSettingPanels.tsx:306-308 (BaseSelectPanel)
  • apps/roam/src/components/settings/components/BlockPropSettingPanels.tsx:386-388 (BaseMultiTextPanel handleAdd)
  • apps/roam/src/components/settings/components/BlockPropSettingPanels.tsx:408-410 (BaseMultiTextPanel handleRemove)

Example pattern:

setTimeout(() => {
  console.log(`[FlagPanel] "${title}" after set, blockProp:`, getter(settingKeys));
}, 500);

Impact: These statements will log to the browser console in production, potentially exposing internal state and cluttering the console output. They also create unnecessary timers.

Prompt for agents
Remove all debug console.log statements wrapped in setTimeout callbacks from BlockPropSettingPanels.tsx. There are 6 occurrences:
1. Lines 128-131 in BaseTextPanel handleChange
2. Lines 201-204 in BaseFlagPanel handleChange
3. Lines 254-257 in BaseNumberPanel handleChange
4. Lines 306-309 in BaseSelectPanel handleChange
5. Lines 386-389 in BaseMultiTextPanel handleAdd
6. Lines 408-411 in BaseMultiTextPanel handleRemove

Each follows the pattern:
setTimeout(() => {
  console.log(`[PanelType] "${title}" after set/add/remove, blockProp:`, getter(settingKeys));
}, 500);

Simply delete these setTimeout blocks entirely.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes we need to do extensive testing before we merge so we will remove this later.

@sid597 sid597 requested a review from mdroidian February 6, 2026 19:19
Copy link

@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 found 1 new potential issue.

View 9 additional findings in Devin Review.

Open in Devin Review

Comment on lines +108 to +110
const [value, setValue] = useState(
() => defaultValue ?? getter(settingKeys) ?? "",
);

Choose a reason for hiding this comment

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

🔴 defaultValue takes precedence over stored settings, causing persisted values to be ignored

The new panel components initialize state with defaultValue ?? getter(settingKeys) ?? fallback, which means if defaultValue is provided (even if it's false), the stored value from block props will be ignored.

Root Cause and Impact

In the usage at ExportSettings.tsx:21, GeneralSettings.tsx:21, etc., defaultValue is set from the old config tree system (e.g., exportSettings.removeSpecialCharacters.value). Since the nullish coalescing operator (??) only falls through for null or undefined, any truthy or false value from the old system will take precedence.

This creates a migration problem:

  1. User opens settings - sees value from old system (defaultValue)
  2. User changes value - new value stored in block props via setter
  3. User reopens settings - sees value from old system again because defaultValue overrides getter

The user's changes appear to be lost on reload because the component always shows the old config tree value instead of reading the newly persisted block props value.

Expected: getter(settingKeys) ?? defaultValue ?? fallback - stored values should take precedence
Actual: defaultValue ?? getter(settingKeys) ?? fallback - defaultValue always wins if defined

Prompt for agents
Fix the state initialization priority in all Base*Panel components in BlockPropSettingPanels.tsx. The getter should be checked first, then fall back to defaultValue. Change the following patterns:

In BaseTextPanel (line 108-110): Change `defaultValue ?? getter(settingKeys) ?? ""` to `getter(settingKeys) ?? defaultValue ?? ""`

In BaseFlagPanel (line 161-163): Change `defaultValue ?? getter(settingKeys) ?? false` to `getter(settingKeys) ?? defaultValue ?? false`

In BaseNumberPanel (line 234-236): Change `defaultValue ?? getter(settingKeys) ?? 0` to `getter(settingKeys) ?? defaultValue ?? 0`

In BaseSelectPanel (line 286-288): Change `defaultValue ?? getter(settingKeys) ?? options[0]` to `getter(settingKeys) ?? defaultValue ?? options[0]`

In BaseMultiTextPanel (line 336-338): Change `defaultValue ?? getter(settingKeys) ?? []` to `getter(settingKeys) ?? defaultValue ?? []`

This ensures that stored block prop values take precedence over the default values passed from the old config tree system.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

}: BaseTextPanelProps) => {
const [value, setValue] = useState(() => getter(settingKeys) ?? defaultValue);
const [value, setValue] = useState(
() => defaultValue ?? getter(settingKeys) ?? "",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Here we are going with defaultValue i.e if there is a default value then use it instead of using the gette() the getter gets from the block props but we don't want to read from there. defaultValue is passed from the caller side (mentioned later) and these defaults use the existing block structure.

Comment on lines +128 to +130
setTimeout(() => {
console.log(`[TextPanel] "${title}" after set, blockProp:`, getter(settingKeys));
}, 500);
Copy link

Choose a reason for hiding this comment

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

Debug console.log statement left in production code. This will spam the console every time a text setting is changed and should be removed:

// Remove these lines:
setTimeout(() => {
  console.log(`[TextPanel] "${title}" after set, blockProp:`, getter(settingKeys));
}, 500);

Spotted by Graphite Agent

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Comment on lines +201 to +203
setTimeout(() => {
console.log(`[FlagPanel] "${title}" after set, blockProp:`, getter(settingKeys));
}, 500);
Copy link

Choose a reason for hiding this comment

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

Debug console.log statement left in production code. This will spam the console every time a flag setting is toggled and should be removed:

// Remove these lines:
setTimeout(() => {
  console.log(`[FlagPanel] "${title}" after set, blockProp:`, getter(settingKeys));
}, 500);

Spotted by Graphite Agent

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Comment on lines +306 to +308
setTimeout(() => {
console.log(`[SelectPanel] "${title}" after set, blockProp:`, getter(settingKeys));
}, 500);
Copy link

Choose a reason for hiding this comment

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

Debug console.log statement left in production code. This will spam the console every time a select setting is changed and should be removed:

// Remove these lines:
setTimeout(() => {
  console.log(`[SelectPanel] "${title}" after set, blockProp:`, getter(settingKeys));
}, 500);

Spotted by Graphite Agent

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Comment on lines +386 to +388
setTimeout(() => {
console.log(`[MultiTextPanel] "${title}" after add, blockProp:`, getter(settingKeys));
}, 500);
Copy link

Choose a reason for hiding this comment

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

Debug console.log statement left in production code. This will spam the console every time an item is added to a multi-text setting and should be removed:

// Remove these lines:
setTimeout(() => {
  console.log(`[MultiTextPanel] "${title}" after add, blockProp:`, getter(settingKeys));
}, 500);

Spotted by Graphite Agent

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

title="remove special characters"
description="Whether or not to remove the special characters in a file name"
settingKeys={["Export", "Remove Special Characters"]}
defaultValue={exportSettings.removeSpecialCharacters.value}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We get the settings on line 11, 12, and use that to pass the default value from here.

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 haven't had a change to review this yet, but please go through and remove any testing code not meant to merge and resolve any unresolved review comments.

Copy link
Collaborator Author

sid597 commented Feb 7, 2026

I put them explicitly because I thought we were going to test them extensively before merging and these logs will help us do that. Should I remove them and after review merge the pr?

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