Skip to content

fix: move getSponsorships function from sponsor forms into summit file#878

Open
tomrndom wants to merge 3 commits into
masterfrom
fix/summit-sponsorship-types
Open

fix: move getSponsorships function from sponsor forms into summit file#878
tomrndom wants to merge 3 commits into
masterfrom
fix/summit-sponsorship-types

Conversation

@tomrndom
Copy link
Copy Markdown

@tomrndom tomrndom commented Apr 16, 2026

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

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

Summary by CodeRabbit

  • Refactor
    • Sponsorship type loading consolidated to a summit-scoped flow for consistent data across sponsor screens.
  • Tests
    • Updated mocks and tests to align with the new summit-scoped sponsorship fetching.
  • No User-Facing Changes
    • No visible UI or pagination changes; end-user behavior and interactions remain unchanged.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 16, 2026

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6338de71-3c74-45cf-82f6-02a7e00131db

📥 Commits

Reviewing files that changed from the base of the PR and between 7460fec and 45491cd.

📒 Files selected for processing (13)
  • src/actions/sponsor-forms-actions.js
  • src/actions/summit-actions.js
  • src/pages/sponsors/show-pages-list-page/__tests__/show-pages-list-page.test.js
  • src/pages/sponsors/show-pages-list-page/index.js
  • src/pages/sponsors/sponsor-forms-list-page/components/form-template/__tests__/form-template-popup.test.js
  • src/pages/sponsors/sponsor-forms-list-page/components/form-template/form-template-popup.js
  • src/pages/sponsors/sponsor-forms-list-page/components/global-template/select-sponsorships-dialog.js
  • src/pages/sponsors/sponsor-forms-list-page/index.js
  • src/pages/sponsors/sponsor-page/tabs/sponsor-pages-tab/__tests__/sponsor-pages-tab.test.js
  • src/reducers/sponsors/__tests__/show-pages-list-reducer.test.js
  • src/reducers/sponsors/show-pages-list-reducer.js
  • src/reducers/sponsors/sponsor-forms-list-reducer.js
  • src/reducers/sponsors/sponsor-page-pages-list-reducer.js
💤 Files with no reviewable changes (1)
  • src/actions/sponsor-forms-actions.js
✅ Files skipped from review due to trivial changes (1)
  • src/pages/sponsors/sponsor-forms-list-page/components/form-template/tests/form-template-popup.test.js
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/reducers/sponsors/sponsor-forms-list-reducer.js
  • src/actions/summit-actions.js
  • src/reducers/sponsors/sponsor-page-pages-list-reducer.js

📝 Walkthrough

Walkthrough

This PR moves sponsorship-types fetching from src/actions/sponsor-forms-actions into src/actions/summit-actions: it removes getSponsorships/RECEIVE_GLOBAL_SPONSORSHIPS, adds getSummitSponsorshipTypes/RECEIVE_SUMMIT_SPONSORSHIP_TYPES, and updates reducers, components, connect wiring, and tests to use the new action and thunk.

Changes

Sponsorship-types action migration

Layer / File(s) Summary
Action Types
src/actions/summit-actions.js, src/actions/sponsor-forms-actions.js
Adds RECEIVE_SUMMIT_SPONSORSHIP_TYPES in summit-actions; removes RECEIVE_GLOBAL_SPONSORSHIPS from sponsor-forms-actions.
Core Thunk
src/actions/summit-actions.js, src/actions/sponsor-forms-actions.js
Adds getSummitSponsorshipTypes(page, perPage) in summit-actions (fetches summit sponsorship-types, dispatches receive, manages loading); removes getSponsorships thunk from sponsor-forms-actions.
Component Wiring
src/pages/sponsors/...
Replace imports and connected props from getSponsorships to getSummitSponsorshipTypes; update mount effects, Promise.all calls, pagination, and connect mappings.
Reducers
src/reducers/sponsors/*
Reducer imports and switch cases updated to respond to RECEIVE_SUMMIT_SPONSORSHIP_TYPES instead of RECEIVE_GLOBAL_SPONSORSHIPS; payload-to-state mapping unchanged.
Tests / Mocks
src/pages/sponsors/.../__tests__/*, src/reducers/sponsors/__tests__/*
Jest mocks and test expectations updated to mock/import getSummitSponsorshipTypes and dispatch/expect RECEIVE_SUMMIT_SPONSORSHIP_TYPES in tests.

Sequence Diagram(s)

sequenceDiagram
  participant UI
  participant Redux
  participant API
  participant Reducer
  UI->>Redux: dispatch getSummitSponsorshipTypes(page, perPage)
  Redux->>API: GET /api/v1/summits/{currentSummit.id}/sponsorships-types
  API-->>Redux: response (data)
  Redux->>Reducer: dispatch RECEIVE_SUMMIT_SPONSORSHIP_TYPES(payload)
  Reducer-->>UI: store updated -> UI re-renders
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • smarcet
  • santipalenque

Poem

🐰 I hopped a thunk from forms to summit hill,
Renamed the action and fetched with steady will,
Components now call the summit route,
Reducers keep the state and stitch the loot,
Tests mock the new thunk — a tiny thrill.

🚥 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 accurately describes the main change: moving the getSponsorships function from sponsor-forms-actions to summit-actions with renaming to getSummitSponsorshipTypes.
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 fix/summit-sponsorship-types

Warning

Review ran into problems

🔥 Problems

Timed out fetching pipeline failures after 30000ms


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

@tomrndom tomrndom force-pushed the fix/summit-sponsorship-types branch from bf9afc3 to 592729e Compare May 6, 2026 14:39
@smarcet smarcet requested review from Copilot and smarcet May 7, 2026 13:17
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR consolidates “global sponsorship types” fetching by moving the thunk/action type from sponsor-forms-actions into summit-actions, and updates reducers/components/tests to use the new summit-level handler.

Changes:

  • Added RECEIVE_GLOBAL_SPONSORSHIPS + getSummitSponsorshipTypes to src/actions/summit-actions.js.
  • Removed RECEIVE_GLOBAL_SPONSORSHIPS and getSponsorships from src/actions/sponsor-forms-actions.js.
  • Updated sponsor-related reducers, pages, and tests to import/dispatch the summit action instead of the sponsor-forms action.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/reducers/sponsors/sponsor-page-pages-list-reducer.js Switches RECEIVE_GLOBAL_SPONSORSHIPS import to come from summit-actions.
src/reducers/sponsors/sponsor-forms-list-reducer.js Switches RECEIVE_GLOBAL_SPONSORSHIPS import to come from summit-actions.
src/reducers/sponsors/show-pages-list-reducer.js Switches RECEIVE_GLOBAL_SPONSORSHIPS import to come from summit-actions.
src/reducers/sponsors/tests/show-pages-list-reducer.test.js Updates action constant import to summit-actions.
src/pages/sponsors/sponsor-page/tabs/sponsor-pages-tab/tests/sponsor-pages-tab.test.js Updates mocks to use getSummitSponsorshipTypes from summit-actions.
src/pages/sponsors/sponsor-forms-list-page/components/global-template/select-sponsorships-dialog.js Replaces getSponsorships with getSummitSponsorshipTypes.
src/pages/sponsors/sponsor-forms-list-page/components/form-template/form-template-popup.js Replaces getSponsorships with getSummitSponsorshipTypes.
src/pages/sponsors/sponsor-forms-list-page/components/form-template/tests/form-template-popup.test.js Updates mocks to reflect new summit action.
src/pages/sponsors/show-pages-list-page/index.js Replaces getSponsorships with getSummitSponsorshipTypes before opening popups.
src/pages/sponsors/show-pages-list-page/tests/show-pages-list-page.test.js Updates mocks/assertions for getSummitSponsorshipTypes.
src/actions/summit-actions.js Adds RECEIVE_GLOBAL_SPONSORSHIPS and getSummitSponsorshipTypes.
src/actions/sponsor-forms-actions.js Removes RECEIVE_GLOBAL_SPONSORSHIPS and the getSponsorships thunk.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 304 to 309
)(params)(dispatch).then(() => {
dispatch(stopLoading());
});
};

export const getSponsorships =
(page = 1, perPage = DEFAULT_PER_PAGE) =>
async (dispatch, getState) => {
const { currentSummitState } = getState();
const accessToken = await getAccessTokenSafely();
const { currentSummit } = currentSummitState;

dispatch(startLoading());

const params = {
page,
per_page: perPage,
access_token: accessToken,
sorting: "order",
expand: "type",
relations: "type",
fields: "id,type.id,type.name"
};

return getRequest(
null,
createAction(RECEIVE_GLOBAL_SPONSORSHIPS),
`${window.API_BASE_URL}/api/v1/summits/${currentSummit.id}/sponsorships-types`,
authErrorHandler
)(params)(dispatch).then(() => {
dispatch(stopLoading());
});
};

export const cloneGlobalTemplate =
Comment thread src/actions/summit-actions.js Outdated
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.

@tomrndom please review

tomrndom added 3 commits May 7, 2026 11:07
…t actions file

Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
@tomrndom tomrndom force-pushed the fix/summit-sponsorship-types branch from 7460fec to 45491cd Compare May 7, 2026 14:07
@tomrndom tomrndom requested a review from smarcet May 7, 2026 14:55
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