Skip to content

feat: move show directory to mui#896

Merged
smarcet merged 3 commits into
masterfrom
feature/move-show-directory-to-mui
May 11, 2026
Merged

feat: move show directory to mui#896
smarcet merged 3 commits into
masterfrom
feature/move-show-directory-to-mui

Conversation

@priscila-moneo
Copy link
Copy Markdown

@priscila-moneo priscila-moneo commented Apr 24, 2026

ref: https://app.clickup.com/t/86b9j5nuu

image

Edit:
image

Summary by CodeRabbit

  • New Features

    • Refreshed directory table with pagination, search, "hide past events" toggle, sponsor counts, and invite-only indicator; improved add/edit/select flows.
  • Bug Fixes

    • Better error-loading view and safer disablement of edit/add/delete when data/permissions are invalid; fixed current-time display timing.
  • Documentation

    • Updated English labels (including "Shows", ID, Event Name, Start Date, End Date, and loading error message).

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 24, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

Refactors SummitDirectoryPage to a functional React component with MuiTable, adds defensive member handling and render-time error fallback; extends loadSummits with term and hidePastEvents filters; updates i18n directory labels and adds error/loading keys.

Changes

Internationalization updates

Layer / File(s) Summary
Data / Labels
src/i18n/en.json
Changed directory.summits value to "Shows"; added directory.shows, directory.error_loading, and new labels directory.id, directory.summit_name, directory.start_date, directory.end_date.

Summit Directory Page Refactor

Layer / File(s) Summary
Component scaffold / imports
src/pages/summits/summit-directory-page.js
Replaced class component with a functional component; added imports for MuiTable, MuiSearchInput, and MUI primitives.
State / mount effects
src/pages/summits/summit-directory-page.js
Initialized local state, coerced summits to an array, derived safeMember, and added useEffect to call clearCurrentSummit() and loadSummits() on mount.
Permissions / defensive handling
src/pages/summits/summit-directory-page.js
Instantiates Member inside try/catch to compute canEditSummit, canAddSummits, canDeleteSummits; falls back to disabling mutation actions on failure.
Handlers / navigation
src/pages/summits/summit-directory-page.js
Added handlers for search, pagination, hide-past-events toggle; uses history.push for select/edit/new routes.
UI wiring
src/pages/summits/summit-directory-page.js
Replaced SweetAlert2/react-bootstrap table and pagination with MuiTable, wired conditional edit/delete/select callbacks and delete-confirmation content; added header, controls (search, toggle, add button).
Error fallback
src/pages/summits/summit-directory-page.js
Added try/catch around render to show an error-loading view using directory.error_loading when exceptions occur.

Summit actions: filtering and escapes

Layer / File(s) Summary
Imports / utilities
src/actions/summit-actions.js
Imported escapeFilterValue from foundation actions utilities and retained authErrorHandler.
API call / params
src/actions/summit-actions.js
Expanded loadSummits signature to loadSummits(page = DEFAULT_CURRENT_PAGE, perPage = DEFAULT_PER_PAGE, term = "", hidePastEvents = false); builds filters[] adding a name filter when term is provided (escaping the term) and an end_date filter when hidePastEvents is true; attaches params["filter[]"] when filters exist and dispatches request as before.

Reducer: directory pagination handling

Layer / File(s) Summary
Action handling
src/reducers/summits/directory-reducer.js
Adds REQUEST_SUMMITS handling to clear summits and update currentPage/perPage from payload; updates RECEIVE_SUMMITS to read per_page from response and set reducer perPage.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    actor User
    participant SummitPage as SummitDirectoryPage (UI)
    participant Actions as loadSummits (Redux Action)
    participant API as Backend API
    participant Store as Redux Store

    User->>SummitPage: open page / interact (search/toggle/paginate)
    SummitPage->>Actions: dispatch loadSummits(term, hidePastEvents, page)
    Actions->>API: HTTP GET /api/v1/summits/all?filter[]=... (filters built, term escaped)
    API-->>Actions: 200 OK (summits list)
    Actions->>Store: dispatch success (summits)
    Store-->>SummitPage: updated props/state (safeSummits)
    SummitPage->>User: render MuiTable with data (or show error if render fails)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Suggested reviewers

  • smarcet

Poem

🐇 I hopped through hooks and tables bright,
Replaced alerts with MuiTable light,
I guarded members, filters sang,
Labels sprouted — error bells rang,
A tiny rabbit cheers this flight!

🚥 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 'feat: move show directory to mui' directly and clearly describes the main change: migrating the show/summit directory interface to Material-UI components.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 feature/move-show-directory-to-mui

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 and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (3)
src/pages/summits/summit-directory-page.js (3)

44-47: Missing dependencies in useEffect.

The dependency array is empty while the effect reads clearCurrentSummit and loadSummits from props. In practice these are stable connect-bound action creators so the effect will behave correctly, but this will trigger react-hooks/exhaustive-deps. Consider either listing them explicitly or adding an eslint disable comment with a brief justification.

♻️ Suggested tweak
-  useEffect(() => {
-    clearCurrentSummit();
-    loadSummits();
-  }, []);
+  useEffect(() => {
+    clearCurrentSummit();
+    loadSummits();
+    // eslint-disable-next-line react-hooks/exhaustive-deps
+  }, []);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/pages/summits/summit-directory-page.js` around lines 44 - 47, The
useEffect currently calls clearCurrentSummit and loadSummits but has an empty
dependency array (in component SummitDirectoryPage), which triggers
react-hooks/exhaustive-deps; update the effect to either include
clearCurrentSummit and loadSummits in the dependency array (useEffect(() => {
clearCurrentSummit(); loadSummits(); }, [clearCurrentSummit, loadSummits])) or,
if you confirm these are stable connect-bound action creators, add an
eslint-disable-next-line comment above the useEffect with a short justification
(e.g., "action creators from connect are stable") so the linter is satisfied and
intent is documented.

204-213: Prop shadowing of imported action creators — worth a sanity check.

The destructured props loadSummits, clearCurrentSummit, and deleteSummit on lines 34–36 shadow the module-level imports used in connect's mapDispatchToProps object on lines 209–213. This is correct (the shorthand object-form of mapDispatchToProps dispatches the actions and exposes them as props with the same names), so the prop versions are the dispatch-bound ones. Just flagging the shadowing since it can be confusing for future readers; renaming either the imports or the props would make the wiring more obvious.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/pages/summits/summit-directory-page.js` around lines 204 - 213, The
component props loadSummits, clearCurrentSummit, and deleteSummit shadow the
same-named imported action creators used in the connect(...) shorthand, which is
confusing; fix by renaming either the imports or the prop variables to make the
dispatch-bound props explicit (e.g., rename imported action creators to
loadSummitsAction/clearCurrentSummitAction/deleteSummitAction and keep props as
loadSummits/clearCurrentSummit/deleteSummit, or keep imports and alias the props
when destructuring such as loadSummits: loadSummitsDispatch), updating
references in SummitDirectoryPage and the connect call accordingly (symbols:
loadSummits, clearCurrentSummit, deleteSummit, connect, mapStateToProps,
SummitDirectoryPage).

72-201: Use an Error Boundary instead of try/catch for rendering errors.

The try/catch wrapping this JSX only catches synchronous errors in the immediate render expression, not errors thrown inside child components like <MuiTable> or its column render functions. Those child errors occur during React's reconciliation phase and bypass the parent's try/catch entirely. Error boundaries (via a class component or the react-error-boundary library) are the idiomatic pattern for displaying the directory.error_loading fallback and will reliably catch errors from MuiTable and its descendants.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/pages/summits/summit-directory-page.js` around lines 72 - 201, The
try/catch around the JSX won't catch errors thrown inside child components like
MuiTable or its column renderers; remove the surrounding try/catch and instead
wrap the rendering (at least the <MuiTable> and related UI) in a proper Error
Boundary (either a class component implementing
componentDidCatch/getDerivedStateFromError or use react-error-boundary's
<ErrorBoundary>) that renders the same fallback UI
(T.translate("directory.error_loading") and the error message) on error; keep
existing handlers (handlePageChange, handleNewSummit, handleEditSummit,
handleSelectSummit) and the columns definition intact and replace the catch
fallback with the ErrorBoundary's fallbackRender or fallbackComponent so child
errors are reliably caught.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/pages/summits/summit-directory-page.js`:
- Around line 44-47: The useEffect currently calls clearCurrentSummit and
loadSummits but has an empty dependency array (in component
SummitDirectoryPage), which triggers react-hooks/exhaustive-deps; update the
effect to either include clearCurrentSummit and loadSummits in the dependency
array (useEffect(() => { clearCurrentSummit(); loadSummits(); },
[clearCurrentSummit, loadSummits])) or, if you confirm these are stable
connect-bound action creators, add an eslint-disable-next-line comment above the
useEffect with a short justification (e.g., "action creators from connect are
stable") so the linter is satisfied and intent is documented.
- Around line 204-213: The component props loadSummits, clearCurrentSummit, and
deleteSummit shadow the same-named imported action creators used in the
connect(...) shorthand, which is confusing; fix by renaming either the imports
or the prop variables to make the dispatch-bound props explicit (e.g., rename
imported action creators to
loadSummitsAction/clearCurrentSummitAction/deleteSummitAction and keep props as
loadSummits/clearCurrentSummit/deleteSummit, or keep imports and alias the props
when destructuring such as loadSummits: loadSummitsDispatch), updating
references in SummitDirectoryPage and the connect call accordingly (symbols:
loadSummits, clearCurrentSummit, deleteSummit, connect, mapStateToProps,
SummitDirectoryPage).
- Around line 72-201: The try/catch around the JSX won't catch errors thrown
inside child components like MuiTable or its column renderers; remove the
surrounding try/catch and instead wrap the rendering (at least the <MuiTable>
and related UI) in a proper Error Boundary (either a class component
implementing componentDidCatch/getDerivedStateFromError or use
react-error-boundary's <ErrorBoundary>) that renders the same fallback UI
(T.translate("directory.error_loading") and the error message) on error; keep
existing handlers (handlePageChange, handleNewSummit, handleEditSummit,
handleSelectSummit) and the columns definition intact and replace the catch
fallback with the ErrorBoundary's fallbackRender or fallbackComponent so child
errors are reliably caught.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 21a65486-d602-4f8e-8b8f-d2654cc934a5

📥 Commits

Reviewing files that changed from the base of the PR and between 8bc0700 and 0e593b0.

📒 Files selected for processing (2)
  • src/i18n/en.json
  • src/pages/summits/summit-directory-page.js

Copy link
Copy Markdown

@santipalenque santipalenque left a comment

Choose a reason for hiding this comment

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

LGTM

@priscila-moneo priscila-moneo force-pushed the feature/move-show-directory-to-mui branch from 0e593b0 to 06890a3 Compare April 24, 2026 20:56
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (3)
src/pages/summits/summit-directory-page.js (3)

44-47: Potentially missing dependencies in useEffect.

The effect depends on clearCurrentSummit and loadSummits but the dependency array is empty. While these come from mapDispatchToProps and are stable across renders (so the current behavior is correct), this will trigger react-hooks/exhaustive-deps warnings and is fragile if the bindings ever change. Either include them in the dependency array or suppress the rule with a comment explaining why.

♻️ Suggested change
   useEffect(() => {
     clearCurrentSummit();
     loadSummits();
+    // eslint-disable-next-line react-hooks/exhaustive-deps
   }, []);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/pages/summits/summit-directory-page.js` around lines 44 - 47, The
useEffect that calls clearCurrentSummit and loadSummits has an empty dependency
array which will trigger react-hooks/exhaustive-deps warnings and is fragile if
those bindings change; update the effect by either adding clearCurrentSummit and
loadSummits to the dependency array (useEffect(() => { clearCurrentSummit();
loadSummits(); }, [clearCurrentSummit, loadSummits])) or, if these props are
known to be stable (e.g., from mapDispatchToProps), keep the empty array but add
a clear explanatory ESLint suppression comment (// eslint-disable-next-line
react-hooks/exhaustive-deps — clearCurrentSummit and loadSummits are stable)
immediately above the useEffect to silence the rule.

72-201: try/catch around JSX won't catch child render errors—use an ErrorBoundary instead.

This try/catch only captures synchronous errors thrown directly in this function (e.g., accessing undefined props while building columns). Errors thrown during render of child components like MuiTable are not caught here and require a React ErrorBoundary (class component with componentDidCatch/getDerivedStateFromError). Event handler errors also escape this wrapper.

If the goal is to handle data normalization issues, the safeguards at lines 39–43 are already sufficient; if the goal is to catch render errors, use an ErrorBoundary instead.

Also avoid exposing err.message directly to users; log it and show a generic message instead.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/pages/summits/summit-directory-page.js` around lines 72 - 201, The
current try/catch wrapping the JSX (around the render that returns the
Grid2/MuiTable) won't catch render-time or child component errors (e.g., inside
MuiTable) — replace this pattern by removing the try/catch and wrapping the
parts that can throw (at least the <MuiTable> and its surrounding UI) with a
React ErrorBoundary (class component implementing
getDerivedStateFromError/componentDidCatch) and use that ErrorBoundary in place
of the try/catch; in the ErrorBoundary component log the actual error (console
or a logger) and render a generic user-facing message instead of directly
exposing err.message; keep existing data normalization safeguards (safeSummits)
and ensure event handlers (handleNewSummit, handleEditSummit,
handleSelectSummit, deleteSummit) have their own try/catch where appropriate.

173-173: Simplify the onDelete callback by removing the unnecessary wrapper lambda.

The MuiTable component passes the row id directly to onDelete. The wrapper (id) => deleteSummit(id) is redundant; deleteSummit can be passed directly, matching the pattern used elsewhere in the codebase (e.g., sponsor-list-page.js).

♻️ Simplification
-          onDelete={canDeleteSummits ? (id) => deleteSummit(id) : undefined}
+          onDelete={canDeleteSummits ? deleteSummit : undefined}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/pages/summits/summit-directory-page.js` at line 173, The onDelete prop is
passed a redundant wrapper lambda in the MuiTable usage; replace
onDelete={canDeleteSummits ? (id) => deleteSummit(id) : undefined} with a direct
reference so it becomes onDelete={canDeleteSummits ? deleteSummit : undefined},
keeping the conditional via canDeleteSummits and using the existing deleteSummit
function (this mirrors the pattern used elsewhere like sponsor-list-page and
avoids the unnecessary (id) => deleteSummit(id) wrapper).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/pages/summits/summit-directory-page.js`:
- Around line 89-175: Columns are marked sortable but sorting is only in-memory
for the current page; either remove sortable: true from the column definitions
or implement server-side sorting by extending loadSummits(order) in
src/actions/summit-actions.js to accept an order string (e.g. "-start_date") and
applying it to the API call, then wire an onSort callback on the component (pass
onSort to MuiTable) that receives (sortCol, sortDir) and calls
loadSummits(currentPage, perPage, computedOrder) and updates options
(sortCol/sortDir) so header clicks trigger a server fetch instead of client-only
reordering; update any initial options to reflect the chosen server-side order.

---

Nitpick comments:
In `@src/pages/summits/summit-directory-page.js`:
- Around line 44-47: The useEffect that calls clearCurrentSummit and loadSummits
has an empty dependency array which will trigger react-hooks/exhaustive-deps
warnings and is fragile if those bindings change; update the effect by either
adding clearCurrentSummit and loadSummits to the dependency array (useEffect(()
=> { clearCurrentSummit(); loadSummits(); }, [clearCurrentSummit, loadSummits]))
or, if these props are known to be stable (e.g., from mapDispatchToProps), keep
the empty array but add a clear explanatory ESLint suppression comment (//
eslint-disable-next-line react-hooks/exhaustive-deps — clearCurrentSummit and
loadSummits are stable) immediately above the useEffect to silence the rule.
- Around line 72-201: The current try/catch wrapping the JSX (around the render
that returns the Grid2/MuiTable) won't catch render-time or child component
errors (e.g., inside MuiTable) — replace this pattern by removing the try/catch
and wrapping the parts that can throw (at least the <MuiTable> and its
surrounding UI) with a React ErrorBoundary (class component implementing
getDerivedStateFromError/componentDidCatch) and use that ErrorBoundary in place
of the try/catch; in the ErrorBoundary component log the actual error (console
or a logger) and render a generic user-facing message instead of directly
exposing err.message; keep existing data normalization safeguards (safeSummits)
and ensure event handlers (handleNewSummit, handleEditSummit,
handleSelectSummit, deleteSummit) have their own try/catch where appropriate.
- Line 173: The onDelete prop is passed a redundant wrapper lambda in the
MuiTable usage; replace onDelete={canDeleteSummits ? (id) => deleteSummit(id) :
undefined} with a direct reference so it becomes onDelete={canDeleteSummits ?
deleteSummit : undefined}, keeping the conditional via canDeleteSummits and
using the existing deleteSummit function (this mirrors the pattern used
elsewhere like sponsor-list-page and avoids the unnecessary (id) =>
deleteSummit(id) wrapper).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 541965e4-7908-4851-8879-2d6c50c08026

📥 Commits

Reviewing files that changed from the base of the PR and between 0e593b0 and 06890a3.

📒 Files selected for processing (2)
  • src/i18n/en.json
  • src/pages/summits/summit-directory-page.js
✅ Files skipped from review due to trivial changes (1)
  • src/i18n/en.json

Comment thread src/pages/summits/summit-directory-page.js Outdated
@priscila-moneo priscila-moneo force-pushed the feature/move-show-directory-to-mui branch 3 times, most recently from fcd09b1 to 40761d0 Compare April 28, 2026 22:44
@priscila-moneo priscila-moneo force-pushed the feature/move-show-directory-to-mui branch from 40761d0 to 7e6425f Compare May 6, 2026 15:15
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (2)
src/pages/summits/summit-directory-page.js (2)

54-57: 💤 Low value

useEffect is missing dependencies.

The effect references loadSummits, clearCurrentSummit, perPage, searchTerm, and hidePastEvents but the dependency array is []. Mount-only execution is presumably intentional here (initial fetch with default state), but react-hooks/exhaustive-deps will flag this and any future change that genuinely needs to react to a prop/state change won't trigger a re-fetch. Consider one of:

  • Add an eslint-disable comment with a note explaining the mount-only intent, or
  • Use a mountedRef pattern, or
  • Add the deps and gate the call appropriately.
🤖 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/pages/summits/summit-directory-page.js` around lines 54 - 57, The
useEffect in summit-directory-page currently calls clearCurrentSummit() and
loadSummits(DEFAULT_CURRENT_PAGE, perPage, searchTerm, hidePastEvents) but has
an empty dependency array which will be flagged; update the effect to explicitly
document the mount-only intent by adding an eslint-disable-next-line
react-hooks/exhaustive-deps above the useEffect and a brief comment like "run
only on mount to perform initial fetch" OR alternatively add the referenced
dependencies (loadSummits, clearCurrentSummit, perPage, searchTerm,
hidePastEvents) to the dependency array and guard the call (e.g., with a
mountedRef or a conditional flag) so loadSummits is only invoked on initial
mount; refer to the useEffect, loadSummits, and clearCurrentSummit symbols when
applying the change.

82-248: ⚖️ Poor tradeoff

Try/catch wrapping JSX in a functional component does not provide real React error boundary semantics.

This only catches synchronous errors during this component's initial render—not errors thrown by child components like MuiTable, during the commit phase, or in event handlers. Since the codebase already uses Sentry.ErrorBoundary at the app level (src/app.js, lines 176–215), consider removing this manual try/catch and relying on the existing app-level boundary, or wrap this page in a dedicated class-component error boundary if page-specific error handling is needed.

The <pre>{err.message}</pre> fallback also risks exposing technical details to end users—a generic error message would be safer.

🤖 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/pages/summits/summit-directory-page.js` around lines 82 - 248, The
component currently wraps its JSX return in a try/catch (surrounding handlers
like handlePageChange, handleSearch, handleHidePastEventsChange and the returned
JSX including MuiTable) which is not a real React error boundary; remove the
outer try/catch and its fallback UI, and either rely on the existing app-level
Sentry.ErrorBoundary or wrap this page in a proper ErrorBoundary class component
(or higher-order boundary) if page-specific handling is required; if you must
keep a local fallback, replace the sensitive err.message display with a generic
user-friendly message instead of exposing technical details.
🤖 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.

Inline comments:
In `@src/actions/summit-actions.js`:
- Around line 162-165: The filter for hidePastEvents is inverted: currently you
push `end_date<${now}` which selects past events; change the condition in the
hidePastEvents block so it pushes a filter that keeps events whose end_date is
at or after now (e.g. use `end_date>=${now}`) — update the code section in
src/actions/summit-actions.js where hidePastEvents is checked and the filters
array is appended.

In `@src/pages/summits/summit-directory-page.js`:
- Around line 122-191: Several UI strings are hardcoded; replace the literals
with i18n lookups: change the column headers for columnKey "sponsor_qty",
"sponsor_forms_qty", and "sponsor_attachments_qty" to use
T.translate("directory.sponsors"), T.translate("directory.forms"), and
T.translate("directory.attachments") respectively; replace the
FormControlLabel.label and Checkbox inputProps["aria-label"] literals with
T.translate("directory.hide_past_events"); and replace the MuiSearchInput
placeholder "Search..." with T.translate("directory.placeholders.search") (or
directory.select) and add the corresponding keys to the directory block in your
i18n JSON.
- Around line 120-134: The sponsor columns (columnKey: "sponsor_qty",
"sponsor_forms_qty", "sponsor_attachments_qty") are rendering 0 because
loadSummits is only requesting fields
"id,name,start_date,end_date,invite_only_registration"; update the loadSummits
call to include the sponsor count fields (or related expansions) so the API
returns sponsor_qty, sponsor_forms_qty and sponsor_attachments_qty (or the
appropriate relation paths) before keeping these columns, e.g., add those field
names or expand the sponsor relation in the fields/expand/relations argument
used by loadSummits; alternatively remove these column definitions from the
table until the backend provides the counts.
- Around line 220-221: MuiTable callbacks consistently receive full row objects
but onDelete currently wraps its arg as (id) => deleteSummit(id), which will
pass the whole row into deleteSummit (which expects an ID). Fix by aligning
shapes: either change the onDelete prop to extract the id from the row before
calling deleteSummit (e.g. call deleteSummit(row.id) from the wrapper) or change
deleteSummit to accept a summit row and use summit.id internally; update the
onDelete assignment (and any related deleteDialogBody or delete handlers) to use
the chosen shape consistently with handleEditSummit, handleSelectSummit, getName
and MuiTable's callback contract.

---

Nitpick comments:
In `@src/pages/summits/summit-directory-page.js`:
- Around line 54-57: The useEffect in summit-directory-page currently calls
clearCurrentSummit() and loadSummits(DEFAULT_CURRENT_PAGE, perPage, searchTerm,
hidePastEvents) but has an empty dependency array which will be flagged; update
the effect to explicitly document the mount-only intent by adding an
eslint-disable-next-line react-hooks/exhaustive-deps above the useEffect and a
brief comment like "run only on mount to perform initial fetch" OR alternatively
add the referenced dependencies (loadSummits, clearCurrentSummit, perPage,
searchTerm, hidePastEvents) to the dependency array and guard the call (e.g.,
with a mountedRef or a conditional flag) so loadSummits is only invoked on
initial mount; refer to the useEffect, loadSummits, and clearCurrentSummit
symbols when applying the change.
- Around line 82-248: The component currently wraps its JSX return in a
try/catch (surrounding handlers like handlePageChange, handleSearch,
handleHidePastEventsChange and the returned JSX including MuiTable) which is not
a real React error boundary; remove the outer try/catch and its fallback UI, and
either rely on the existing app-level Sentry.ErrorBoundary or wrap this page in
a proper ErrorBoundary class component (or higher-order boundary) if
page-specific handling is required; if you must keep a local fallback, replace
the sensitive err.message display with a generic user-friendly message instead
of exposing technical details.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6895a491-7988-49b9-83fd-5ceb8d440bf6

📥 Commits

Reviewing files that changed from the base of the PR and between 06890a3 and 9c5543c.

📒 Files selected for processing (3)
  • src/actions/summit-actions.js
  • src/i18n/en.json
  • src/pages/summits/summit-directory-page.js

Comment thread src/actions/summit-actions.js
Comment on lines +120 to +134
{
columnKey: "sponsor_qty",
header: "Sponsors",
render: (row) => row.sponsor_qty ?? 0
},
{
columnKey: "sponsor_forms_qty",
header: "Forms",
render: (row) => row.sponsor_forms_qty ?? 0
},
{
columnKey: "sponsor_attachments_qty",
header: "Attachments",
render: (row) => row.sponsor_attachments_qty ?? 0
},
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Sponsor columns will always show 0 — fields aren't requested from the API.

The columns sponsor_qty, sponsor_forms_qty, and sponsor_attachments_qty rely on properties that aren't included in the fields param of loadSummits (which currently requests only "id,name,start_date,end_date,invite_only_registration"). As a result, row.sponsor_qty ?? 0 will always render 0, making these columns misleading.

Either expand the fields (and expand/relations if needed) in loadSummits so the API returns these counts, or remove the columns until the backend supplies them.

🤖 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/pages/summits/summit-directory-page.js` around lines 120 - 134, The
sponsor columns (columnKey: "sponsor_qty", "sponsor_forms_qty",
"sponsor_attachments_qty") are rendering 0 because loadSummits is only
requesting fields "id,name,start_date,end_date,invite_only_registration"; update
the loadSummits call to include the sponsor count fields (or related expansions)
so the API returns sponsor_qty, sponsor_forms_qty and sponsor_attachments_qty
(or the appropriate relation paths) before keeping these columns, e.g., add
those field names or expand the sponsor relation in the fields/expand/relations
argument used by loadSummits; alternatively remove these column definitions from
the table until the backend provides the counts.

Comment thread src/pages/summits/summit-directory-page.js Outdated
Comment thread src/pages/summits/summit-directory-page.js
@priscila-moneo priscila-moneo force-pushed the feature/move-show-directory-to-mui branch from 9c5543c to f8aab1b Compare May 6, 2026 22:23
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 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.

Inline comments:
In `@src/pages/summits/summit-dashboard-page.js`:
- Around line 84-85: Guard against member being undefined before calling Member
or canEditSummit: check the optional member prop and only construct Member when
present (e.g., set memberObj to null when member is falsy) and compute
canEditSummit using a safe fallback (call memberObj.canEditSummit() only when
memberObj exists and default to false otherwise); update the code around the
Member instantiation and the canEditSummit usage so Member and canEditSummit are
not invoked when member is undefined.

In `@src/reducers/summits/directory-reducer.js`:
- Around line 26-31: In the REQUEST_SUMMITS case in directory-reducer.js do not
clear summits (remove the summits: [] assignment); instead preserve
state.summits and only update pagination fields like currentPage and perPage
(and optionally set a loading flag). Locate the REQUEST_SUMMITS branch that
returns { ...state, summits: [], currentPage: page, perPage } and change it to
keep existing summits (e.g., return { ...state, currentPage: page, perPage } )
so UI isn’t emptied on failed fetches.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d6d97af8-f958-4fd1-a4dd-ef63f8401ae7

📥 Commits

Reviewing files that changed from the base of the PR and between 9c5543c and 6303b25.

📒 Files selected for processing (5)
  • src/actions/summit-actions.js
  • src/i18n/en.json
  • src/pages/summits/summit-dashboard-page.js
  • src/pages/summits/summit-directory-page.js
  • src/reducers/summits/directory-reducer.js
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/i18n/en.json
  • src/pages/summits/summit-directory-page.js

Comment on lines +84 to +85
const memberObj = new Member(member);
const canEditSummit = memberObj.canEditSummit();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check how the Member constructor handles undefined/null
ast-grep --pattern 'class Member {
  constructor($$$) {
    $$$
  }
  $$$
}'

Repository: fntechgit/summit-admin

Length of output: 6183


🏁 Script executed:

#!/bin/bash
# Check the PropTypes declaration and the context around lines 84-85
cat -n src/pages/summits/summit-dashboard-page.js | sed -n '1,100p'

Repository: fntechgit/summit-admin

Length of output: 3783


🏁 Script executed:

#!/bin/bash
# Search for PropTypes definition in the component
cat -n src/pages/summits/summit-dashboard-page.js | tail -n +100

Repository: fntechgit/summit-admin

Length of output: 17420


Guard against undefined member before calling canEditSummit().

The member prop is optional (no .isRequired in PropTypes at line 464), so it can arrive as undefined. The Member constructor stores it without validation, and canEditSummit() immediately accesses this._member.groups without a null check, causing a runtime crash. The early-return guard on line 87 only checks currentSummit, not member.

Add a null check before instantiating the Member or before calling canEditSummit():

const memberObj = member ? new Member(member) : null;
const canEditSummit = memberObj?.canEditSummit() ?? false;
🤖 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/pages/summits/summit-dashboard-page.js` around lines 84 - 85, Guard
against member being undefined before calling Member or canEditSummit: check the
optional member prop and only construct Member when present (e.g., set memberObj
to null when member is falsy) and compute canEditSummit using a safe fallback
(call memberObj.canEditSummit() only when memberObj exists and default to false
otherwise); update the code around the Member instantiation and the
canEditSummit usage so Member and canEditSummit are not invoked when member is
undefined.

Comment on lines +26 to +31
return {
...state,
summits: [],
currentPage: page,
perPage
};
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Avoid clearing summits during REQUEST_SUMMITS to prevent empty state on fetch errors.

On Line 28, resetting to summits: [] immediately drops visible data before the request succeeds. If the request fails, the reducer never restores the previous list, leaving the directory blank until another successful load.

💡 Proposed fix
       return {
         ...state,
-        summits: [],
         currentPage: page,
         perPage
       };
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return {
...state,
summits: [],
currentPage: page,
perPage
};
return {
...state,
currentPage: page,
perPage
};
🤖 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/reducers/summits/directory-reducer.js` around lines 26 - 31, In the
REQUEST_SUMMITS case in directory-reducer.js do not clear summits (remove the
summits: [] assignment); instead preserve state.summits and only update
pagination fields like currentPage and perPage (and optionally set a loading
flag). Locate the REQUEST_SUMMITS branch that returns { ...state, summits: [],
currentPage: page, perPage } and change it to keep existing summits (e.g.,
return { ...state, currentPage: page, perPage } ) so UI isn’t emptied on failed
fetches.

Copy link
Copy Markdown

@smarcet smarcet left a comment

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 4aada82 into master May 11, 2026
9 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.

3 participants