fix: move getSponsorships function from sponsor forms into summit file#878
fix: move getSponsorships function from sponsor forms into summit file#878tomrndom wants to merge 3 commits into
Conversation
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (13)
💤 Files with no reviewable changes (1)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughThis 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. ChangesSponsorship-types action migration
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsTimed out fetching pipeline failures after 30000ms Comment |
bf9afc3 to
592729e
Compare
There was a problem hiding this comment.
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+getSummitSponsorshipTypestosrc/actions/summit-actions.js. - Removed
RECEIVE_GLOBAL_SPONSORSHIPSandgetSponsorshipsfromsrc/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.
| )(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 = |
…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>
7460fec to
45491cd
Compare
ref: https://app.clickup.com/t/86b9dnh90
Signed-off-by: Tomás Castillo tcastilloboireau@gmail.com
Summary by CodeRabbit