fix: fix bug in event list with null option#825
fix: fix bug in event list with null option#825priscila-moneo wants to merge 1 commit intomasterfrom
Conversation
📝 WalkthroughWalkthroughThis pull request introduces event type constant renaming, extracts utility functions for dropdown list building, refactors the summit event list page to use these utilities, and adds corresponding unit tests to verify the changes. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
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.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/reducers/selection_plans/selection-plan-reducer.js (1)
122-127:⚠️ Potential issue | 🟠 MajorReset
allowedMemberson logout as well.This branch only clears
entityanderrors.allowedMemberssurvives the logout, so the next session can briefly inherit stale allowed-member data until a refetch replaces it.💡 Suggested fix
case LOGOUT_USER: { // we need this in case the token expired while editing the form if (payload.hasOwnProperty("persistStore")) { return state; } - return { ...state, entity: { ...DEFAULT_ENTITY }, errors: {} }; + return { + ...DEFAULT_STATE, + entity: { ...DEFAULT_ENTITY }, + allowedMembers: { ...DEFAULT_STATE.allowedMembers }, + errors: {} + }; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/reducers/selection_plans/selection-plan-reducer.js` around lines 122 - 127, The LOGOUT_USER branch currently resets only entity and errors but leaves allowedMembers populated; update the LOGOUT_USER handler in selection-plan-reducer (the case handling LOGOUT_USER) to also reset allowedMembers (e.g., set allowedMembers: [] or to an existing DEFAULT_ALLOWED_MEMBERS constant) when returning the cleared state while keeping the early return for payload.hasOwnProperty("persistStore") unchanged so persisted-logout logic still returns state.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@src/reducers/selection_plans/selection-plan-reducer.js`:
- Around line 122-127: The LOGOUT_USER branch currently resets only entity and
errors but leaves allowedMembers populated; update the LOGOUT_USER handler in
selection-plan-reducer (the case handling LOGOUT_USER) to also reset
allowedMembers (e.g., set allowedMembers: [] or to an existing
DEFAULT_ALLOWED_MEMBERS constant) when returning the cleared state while keeping
the early return for payload.hasOwnProperty("persistStore") unchanged so
persisted-logout logic still returns state.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 26c5e54c-86b4-49e1-89d6-f04c5b53f55b
📒 Files selected for processing (7)
src/actions/selection-plan-actions.jssrc/pages/events/summit-event-list-page.jssrc/reducers/selection_plans/__tests__/selection-plan-reducer.test.jssrc/reducers/selection_plans/selection-plan-reducer.jssrc/reducers/summits/__tests__/current-summit-reducer.test.jssrc/utils/events/__tests__/summit-event-list-page.utils.test.jssrc/utils/events/summit-event-list-page.utils.js
ref: https://app.clickup.com/t/86b8rpumr
Root cause: The Events page assumed all API items in event_types/tracks were always valid objects, so it directly read name during DDL mapping and crashed when malformed/null entries were returned.
Solution: Centralized and reused a defensive DDL builder that validates items, safely normalizes sorting, and maps options only from valid records before rendering.
Summary by CodeRabbit
New Features
Bug Fixes
Tests