Skip to content

ENG-1272 Migrate all small global settings components#688

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

ENG-1272 Migrate all small global settings components#688
sid597 wants to merge 8 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 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
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 found 1 new potential issue.

View 6 additional findings in Devin Review.

Open in Devin Review

@sid597 sid597 requested a review from mdroidian February 6, 2026 19:19
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 found 1 new potential issue.

View 9 additional findings in Devin Review.

Open in Devin Review

}: 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.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this is a good pattern. That means we have to make sure that every time <BaseTextPanel> is called, it is using the default value. This is too error prone and requires manual checking of all callers.

Let's remove the getter() altogether. I'm not sure what purpose it is serving now anyway.

If you want to have some code in here so you don't have to remember to put it back, code it as if we were using a flag to switch between blocks/props. But have the flag null or false (so that it always uses blocks until we add the mechanism to switch the flag to use props.)

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh I see, you are using defaultValue as initialValue. Let's change it to initialValue

Initial Value = the initial value we are passing to another component which is handling that value's state going forward (not meant to change)
Default Value = if there no value, use this value (not meant to change)
Value = the value we care about to update the UI, the value we keep in state. (this is meant to change)

so generally something like this:
[value, setvValue] = useState(initialValue ?? defaultValue)

But the "let's remove the getter() comment still stands"

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?

Copy link
Contributor

mdroidian commented Feb 8, 2026

As we discussed: re: new system to stop testing/unwanted code merging into production

don't commit the code. Add it to the body of the PR,

even better, add it as suggested code in line in a GitHub comment, so that it can be co-located with where it should go, so the reviewer can see it as they review

const newValue = e.target.value;
setValue(newValue);
setter(settingKeys, newValue);
syncToBlock?.(newValue);
Copy link
Collaborator Author

@sid597 sid597 Feb 9, 2026

Choose a reason for hiding this comment

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

For testing, add the following here

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

same goes for all the other base panels, we should add this console.log to all the base panels for testing.

@sid597 sid597 requested a review from mdroidian February 9, 2026 05:47
}

// For testing purposes
// await initSchema();
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

uncomment this for testing

STREAMLINE_STYLING_KEY,
DISALLOW_DIAGNOSTICS,
} from "./data/userSettings";
// import { initSchema } from "./components/settings/utils/init";
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

uncomment this for testing

@sid597 sid597 force-pushed the eng-1272-migrate-all-small-global-settings-component branch from 53f1015 to 0ef04ee Compare February 9, 2026 07:44
@sid597 sid597 force-pushed the eng-1272-migrate-all-small-global-settings-component branch from 0ef04ee to 15f3a6b Compare February 9, 2026 09:46
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.

So a few issues in this one:

  • let's remove the getter() if we aren't using it yet, or put it behind a null/false flag that is intended to be used in the future
  • changing defaultValue to initialValue (this can be deferred, if it is, please link to the created task in which it will be completed)
  • clarify / simplify the logic for suggestive mode
  • please format all files with prettier before tagging for review
  • remove any code not intended to be merged

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

Choose a reason for hiding this comment

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

I don't think this is a good pattern. That means we have to make sure that every time <BaseTextPanel> is called, it is using the default value. This is too error prone and requires manual checking of all callers.

Let's remove the getter() altogether. I'm not sure what purpose it is serving now anyway.

If you want to have some code in here so you don't have to remember to put it back, code it as if we were using a flag to switch between blocks/props. But have the flag null or false (so that it always uses blocks until we add the mechanism to switch the flag to use props.)

}: BaseFlagPanelProps) => {
const [value, setValue] = useState(() => getter(settingKeys) ?? defaultValue);
const [value, setValue] = useState(
() => defaultValue ?? getter(settingKeys) ?? false,
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above comment

}
settingKeys={["Suggestive Mode", "Include Parent And Child Blocks"]}
defaultValue={settings.suggestiveMode.includeParentAndChildren.value}
overrideValue={includePageRelations ? true : undefined}
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this called overrideValue and not just value? What value is it overriding?

Generally it's
defaultValue and value where we use defaultValue if there is no value defined.

: "Include relations from parent and child blocks"
}
settingKeys={["Suggestive Mode", "Include Parent And Child Blocks"]}
defaultValue={settings.suggestiveMode.includeParentAndChildren.value}
Copy link
Contributor

Choose a reason for hiding this comment

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

From this panel alone this is confusing, can you walk me through the logic here?

Is it:
The value is from includeParentandChildren, but if includePageRelations is true then it is overriden? Overriden how?

Let's try to just use defaultValue/value and do the logic explicitly above so it's easy for anyone to follow how we derive defaultValue and value

<div className="flex flex-col gap-4 p-1">
<div className="sync-config-settings">
<FlagPanel
<GlobalFlagPanel
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is there no value prop on this component?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, it looks like you are using defaultValue like an initialValue. This is kind of confusing when defaultValue usually means

  • this is an uncontrolled component
    or
  • if there is no value, use defaultValue

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

Choose a reason for hiding this comment

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

Oh I see, you are using defaultValue as initialValue. Let's change it to initialValue

Initial Value = the initial value we are passing to another component which is handling that value's state going forward (not meant to change)
Default Value = if there no value, use this value (not meant to change)
Value = the value we care about to update the UI, the value we keep in state. (this is meant to change)

so generally something like this:
[value, setvValue] = useState(initialValue ?? defaultValue)

But the "let's remove the getter() comment still stands"

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