Fix: crashing columns, infinite loops and things!#2795
Conversation
WalkthroughgetColumnOrder and saveColumnOrder in the preferences store now deduplicate column ID arrays before returning or persisting them. The spreadsheet component adds a new setupColumns routine that removes system columns (e.g., Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/lib/stores/preferences.ts`:
- Around line 265-269: The saveColumnOrder method can throw when columnIds is
undefined because new Set(undefined) is invalid; in saveColumnOrder (and where
teamPreferences.columnOrder is set) coerce columnIds to a default empty array
before creating the Set (e.g., use columnIds ?? [] or Array.isArray check) so
teamPreferences.columnOrder[tableId] = Array.from(new Set(defaultedColumnIds));
ensure you still call ensureObjectProperty(teamPreferences, 'columnOrder') first
and use the same symbol names (saveColumnOrder, teamPreferences, columnOrder,
columnIds) when making the change.
What does this PR do?
(Provide a description of what this PR does.)
Test Plan
(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)
Related PRs and Issues
(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)
Have you read the Contributing Guidelines on issues?
(Write your answer here.)
Summary by CodeRabbit
Bug Fixes
New Features / Improvements
✏️ Tip: You can customize this high-level summary in your review settings.