Skip to content

fix: add initial value on summits to avoid crash checking length - #313

Merged
smarcet merged 1 commit into
mainfrom
fix/summits-dropdown-array-value
Aug 11, 2026
Merged

fix: add initial value on summits to avoid crash checking length#313
smarcet merged 1 commit into
mainfrom
fix/summits-dropdown-array-value

Conversation

@tomrndom

@tomrndom tomrndom commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

ref: https://app.clickup.com/t/9014802374/86bakf3mp

Signed-off-by: Tomás Castillo tcastilloboireau@gmail.com

Summary by CodeRabbit

  • Bug Fixes
    • Improved the summits dropdown’s stability when no summit data is available.
    • Prevented rendering errors caused by missing summit information.

Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
@tomrndom
tomrndom requested a review from smarcet August 10, 2026 20:17
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

SummitsDropdown now defaults the omitted summits prop to an empty array during initialization and rendering.

Changes

Summits dropdown

Layer / File(s) Summary
Default summits prop
src/components/mui/summits-dropdown.js
The summits prop now defaults to an empty array when it is not provided.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Suggested reviewers: smarcet

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: adding an initial value for summits to prevent a length-check crash.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/summits-dropdown-array-value

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/components/mui/summits-dropdown.js (1)

23-23: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a regression test for the omitted summits prop.

The current tests pass summits={[]} explicitly. Add a test that omits the prop and verifies rendering and fetchAllSummits invocation. This test will protect the crash fix.

🧪 Proposed regression test
+  test("defaults summits to an empty array when omitted", async () => {
+    render(<SummitsDropdown onChange={jest.fn()} />);
+    await waitFor(() => {
+      expect(
+        require("../../../utils/query-actions").fetchAllSummits
+      ).toHaveBeenCalled();
+    });
+  });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/mui/summits-dropdown.js` at line 23, Add a regression test for
the `SummitsDropdown` component that omits the `summits` prop entirely, verifies
it renders successfully, and confirms `fetchAllSummits` is invoked. Keep the
existing explicit empty-array coverage unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/components/mui/summits-dropdown.js`:
- Line 23: Add a regression test for the `SummitsDropdown` component that omits
the `summits` prop entirely, verifies it renders successfully, and confirms
`fetchAllSummits` is invoked. Keep the existing explicit empty-array coverage
unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 804cd759-bc44-46c3-9a98-92886bd9904e

📥 Commits

Reviewing files that changed from the base of the PR and between 3292a07 and 078b7b0.

📒 Files selected for processing (1)
  • src/components/mui/summits-dropdown.js

@smarcet smarcet left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@smarcet
smarcet merged commit 037785f into main Aug 11, 2026
5 checks passed
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