Skip to content

fix: add sponsor to dependency array on forms and pages tabs#879

Open
tomrndom wants to merge 3 commits intomasterfrom
fix/sponsor-forms-page-lists
Open

fix: add sponsor to dependency array on forms and pages tabs#879
tomrndom wants to merge 3 commits intomasterfrom
fix/sponsor-forms-page-lists

Conversation

@tomrndom
Copy link
Copy Markdown

@tomrndom tomrndom commented Apr 16, 2026

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

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

Summary by CodeRabbit

  • Bug Fixes
    • Sponsor forms and pages now refresh correctly when switching sponsors, ensuring you see the right data for the selected sponsor.
    • Sponsor media uploads and purchase lists now also refresh reliably when changing sponsors.
    • General improvements to data loading when the active sponsor changes for more consistent, up-to-date views.

Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
@tomrndom tomrndom requested a review from smarcet April 16, 2026 15:41
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 16, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b2f84be7-1be5-4dd1-a831-00dd597a4702

📥 Commits

Reviewing files that changed from the base of the PR and between e0df353 and b27e964.

📒 Files selected for processing (2)
  • src/pages/sponsors/sponsor-page/tabs/sponsor-media-upload-tab/index.js
  • src/pages/sponsors/sponsor-page/tabs/sponsor-purchases-tab/index.js

📝 Walkthrough

Walkthrough

Updated multiple sponsor-page tabs so data-fetching useEffects re-run when sponsor?.id changes; some components now receive sponsor from Redux, and one callback was reformatted without behavior changes.

Changes

Cohort / File(s) Summary
Sponsor Data Fetching
src/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/index.js, src/pages/sponsors/sponsor-page/tabs/sponsor-pages-tab/index.js, src/pages/sponsors/sponsor-page/tabs/sponsor-media-upload-tab/index.js, src/pages/sponsors/sponsor-page/tabs/sponsor-purchases-tab/index.js
Changed useEffect dependency arrays from [] to [sponsor?.id] so data-loading calls re-run when the sponsor identity changes (e.g., getSponsorManagedForms, getSponsorCustomizedForms, getSponsorManagedPages, getSponsorCustomizedPages, getSponsorMURequests, getGeneralMURequests, purchase fetches).
Redux prop wiring
src/pages/sponsors/sponsor-page/tabs/sponsor-media-upload-tab/index.js, src/pages/sponsors/sponsor-page/tabs/sponsor-purchases-tab/index.js
mapStateToProps now includes currentSponsorState and maps sponsor: currentSponsorState.entity, adding a sponsor prop to these components.
Callback reformatting
src/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/index.js
Rewrote handleSaveFormFromTemplate from a single-line arrow with .then(...) into a multi-line arrow function; no behavioral change.

Sequence Diagram(s)

sequenceDiagram
  participant UI as "Sponsor Tab UI"
  participant Redux as "Redux store"
  participant API as "Backend API"
  participant Worker as "Effect / Thunk"

  rect rgba(200,230,255,0.5)
  UI->>Redux: select sponsor (sponsor.id changes)
  Redux-->>UI: props update (sponsor prop)
  end

  rect rgba(220,255,200,0.5)
  UI->>Worker: useEffect triggers on sponsor?.id
  Worker->>API: dispatch fetch actions (managed/customized pages/forms/media/purchases)
  API-->>Worker: return data
  Worker->>Redux: store results
  Redux-->>UI: render updated lists
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • smarcet
  • romanetar

Poem

🐰 I nibble code where sponsors hop,
When IDs change, the fetches pop,
Forms, pages, media come alive,
Redux guides the data drive,
The rabbit cheers — the tabs now hop! 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding sponsor to dependency arrays on forms and pages tabs, which is reflected in most of the modified files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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 fix/sponsor-forms-page-lists

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

Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
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.

1 participant