fix: address PR #244 review comments#245
fix: address PR #244 review comments#245BillChirico merged 4 commits intofeat/issue-243-config-editor-refactorfrom
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
e3a6b77
into
feat/issue-243-config-editor-refactor
|
| Filename | Overview |
|---|---|
| web/src/lib/config-updates.ts | Refactors updateArrayItem, removeArrayItem, and appendArrayItem to track each traversal level in a levels array and rebuild bottom-up. Correctly fixes the previous bug where paths with 3+ segments would spread the wrong (deepest) object at every intermediate level. Empty-path guard added. Logic is correct and verified for paths of length 1, 2, and 3+. |
| web/src/components/dashboard/config-editor.tsx | Adds guildId to the useEffect dep array that clears the undo snapshot, ensuring stale snapshots from a previous guild cannot be applied to the current guild. The biome-ignore comment is present but its stated justification is slightly misleading. |
| web/src/components/dashboard/config-sections/ModerationSection.tsx | Introduces local blockedDomainsRaw state with onBlur-based commit to prevent input interruptions during typing. The useEffect sync from draftConfig correctly normalizes the input after blur but can also reset in-progress typing if the parent draftConfig is externally mutated (e.g., undo). |
| web/src/components/dashboard/config-sections/PermissionsSection.tsx | Same onBlur pattern as ModerationSection applied to bot-owners input. Same useEffect sync trade-off applies. |
| web/src/components/dashboard/config-sections/ReputationSection.tsx | Same onBlur pattern applied to level-thresholds input with correct numeric parsing and ascending sort on commit. Same useEffect sync trade-off applies. |
| web/src/components/dashboard/config-sections/ChallengesSection.tsx | Single-line change from grid-cols-2 to grid-cols-1 md:grid-cols-2 for responsive layout. Straightforward and correct. |
| web/src/components/dashboard/config-sections/StarboardSection.tsx | Same responsive grid change as ChallengesSection. Straightforward and correct. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User types in input] --> B[onChange fires - setRaw updates local state]
B --> C{User blurs?}
C -- No --> B
C -- Yes --> D[onBlur fires - parse raw string and call onFieldChange]
D --> E[Parent updates draftConfig prop]
E --> F[displayString recomputed from new draftConfig]
F --> G{displayString value changed?}
G -- No --> H[useEffect skips - raw state unchanged]
G -- Yes --> I[useEffect fires - setRaw to normalised display string]
I --> J[Input shows canonical comma-separated form]
K[External update such as undo or guild change] --> E
Last reviewed commit: 5c09e17
…re (#244) * refactor(config): add normalization utilities for config editor * refactor(config): add config update utilities with tests * refactor(config): extract section components from config-editor * refactor(config): simplify config-editor.tsx to orchestration layer * fix: address PR #244 review comments (#245) * fix(sections): responsive grid layouts * fix(config-editor): clear undo snapshot on guild change * fix(config-updates): correct buildPath for deep nesting * fix(sections): use onBlur for comma-separated inputs --------- Co-authored-by: Bill <[email protected]> * fix: address remaining PR #244 review comments - AiAutoModSection: render even when aiAutoMod is missing - EngagementSection: use stable keys for badge rows - StarboardSection: fix default Any button active state - TriageSection: normalize moderationLogChannel before patch - WelcomeSection: read dmSteps from event target in onBlur - config-updates: validate array index bounds before mutations --------- Co-authored-by: Bill <[email protected]>
…re (#244) * refactor(config): add normalization utilities for config editor * refactor(config): add config update utilities with tests * refactor(config): extract section components from config-editor * refactor(config): simplify config-editor.tsx to orchestration layer * fix: address PR #244 review comments (#245) * fix(sections): responsive grid layouts * fix(config-editor): clear undo snapshot on guild change * fix(config-updates): correct buildPath for deep nesting * fix(sections): use onBlur for comma-separated inputs --------- Co-authored-by: Bill <[email protected]> * fix: address remaining PR #244 review comments - AiAutoModSection: render even when aiAutoMod is missing - EngagementSection: use stable keys for badge rows - StarboardSection: fix default Any button active state - TriageSection: normalize moderationLogChannel before patch - WelcomeSection: read dmSteps from event target in onBlur - config-updates: validate array index bounds before mutations --------- Co-authored-by: Bill <[email protected]>
Addresses review comments from PR #244.
Fixes Applied
Critical Fixes
guildIdto dependency array so undo snapshot clears on guild changeInput Normalization
Mobile Responsiveness
grid-cols-2togrid-cols-1 md:grid-cols-2Validation
Closes review threads from #244