fix: adjust popup pattern, add isSaving on popups, return promises#994
fix: adjust popup pattern, add isSaving on popups, return promises#994tomrndom wants to merge 7 commits into
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughDialogs now manage save-in-progress state and close after successful submissions. Parent pages conditionally mount dialogs, refresh lists after saves, and remove explicit close calls. Save actions return promises, while tests update async mocks and removed dialog props. ChangesDialog save-state and mounting
Estimated code review effort: 3 (Moderate) | ~30 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/pages/sponsors-global/form-templates/sponsor-inventory-popup.js (1)
1-1:⚠️ Potential issue | 🔴 Critical | ⚡ Quick winMissing
useStateimport causes ReferenceError.Line 48 uses
useStatebut it is not imported from React on line 1. This will throw a runtime error when the component renders.🐛 Proposed fix to add the missing import
-import React from "react"; +import React, { useState } from "react";Also applies to: 48-49
🤖 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/sponsors-global/form-templates/sponsor-inventory-popup.js` at line 1, The component uses the useState hook on lines 48-49 but it is not imported in the React import statement on line 1. Add useState to the destructured import from React by updating the import statement to include useState alongside React, so that the useState hook is available when the component renders.
🤖 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/sponsors-global/inventory/inventory-list-page.js`:
- Around line 249-259: The `handleInventorySave` function relies on the promise
returned by `saveInventoryItem` to determine when the save operation is truly
complete and whether it succeeded or failed, but the `saveInventoryItem`
function in src/actions/inventory-item-actions.js (around lines 205-300) is
currently swallowing errors and resolving prematurely before nested image and
metadata saves finish. Fix this by ensuring the `saveInventoryItem` function
waits for all nested save operations (image saves and metadata saves) to
complete before resolving, and properly rejects the returned promise if any part
of the save process fails, so that the promise chain accurately reflects the
true completion status and allows error handling in downstream code like
dialog-close logic to respond correctly.
In `@src/pages/sponsors-global/page-templates/page-template-list-page.js`:
- Around line 117-128: The handleSavePageTemplate function does not return a
promise, causing runtime failures when the popup contract attempts to chain
.then on the result. Add a return statement before the savePageTemplate promise
chain to ensure the entire promise returned from
savePageTemplate(entity).then(...) is returned from the handler, allowing
callers to properly chain .then(onClose) on the result.
- Around line 118-127: The savePageTemplate call in the
page-template-list-page.js file has a redundant .then() chain that invokes
getPageTemplates again, causing duplicate requests. Since savePageTemplate
already dispatches getPageTemplates internally, remove the entire .then() block
that calls getPageTemplates with the term, DEFAULT_CURRENT_PAGE, perPage, order,
orderDir, and showArchived parameters. Simply call savePageTemplate(entity)
without the chained getPageTemplates invocation to let the internal dispatch
handle the refresh with the appropriate state values.
In `@src/pages/sponsors/summit-sponsorship-list-page.js`:
- Around line 99-101: The saveSummitSponsorship thunk in
src/actions/sponsor-actions.js does not return the promise from the API request
(putRequest or postRequest), causing the .then() chain in
summit-sponsorship-list-page.js to execute prematurely. Modify the
saveSummitSponsorship function to return the actual promise from the
putRequest/postRequest call so that getSummitSponsorships is only invoked after
the API write completes, preventing the popup from closing before persistence
finishes.
---
Outside diff comments:
In `@src/pages/sponsors-global/form-templates/sponsor-inventory-popup.js`:
- Line 1: The component uses the useState hook on lines 48-49 but it is not
imported in the React import statement on line 1. Add useState to the
destructured import from React by updating the import statement to include
useState alongside React, so that the useState hook is available when the
component renders.
🪄 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: 7a8515e5-6d59-4f49-a419-d75f0973d2c7
📒 Files selected for processing (21)
src/pages/sponsors-global/form-templates/form-template-item-list-page.jssrc/pages/sponsors-global/form-templates/form-template-list-page.jssrc/pages/sponsors-global/form-templates/form-template-popup.jssrc/pages/sponsors-global/form-templates/sponsor-inventory-popup.jssrc/pages/sponsors-global/inventory/inventory-list-page.jssrc/pages/sponsors-global/page-templates/page-template-list-page.jssrc/pages/sponsors-global/page-templates/page-template-popup/index.jssrc/pages/sponsors/popup/add-sponsor-popup.jssrc/pages/sponsors/popup/edit-tier-popup.jssrc/pages/sponsors/show-pages-list-page/__tests__/show-pages-list-page.test.jssrc/pages/sponsors/show-pages-list-page/index.jssrc/pages/sponsors/sponsor-list-page.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/components/manage-items/sponsor-forms-manage-items.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-pages-tab/__tests__/sponsor-pages-tab.test.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-pages-tab/components/add-sponsor-page-template-popup/index.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-pages-tab/index.jssrc/pages/sponsors/summit-sponsorship-list-page.jssrc/pages/sponsorship-types/__tests__/sponsorship-list-page.test.jssrc/pages/sponsorship-types/components/sponsorship-dialog.jssrc/pages/sponsorship-types/sponsorship-list-page.jssrc/pages/tags/tag-list-page.js
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/inventory-item-actions.js`:
- Around line 236-250: The stopLoading() dispatch call inside the inner
.finally() block (after Promise.all) only executes when the putRequest succeeds.
If the putRequest fails, the outer catch block rethrows the error without ever
clearing the loading state. Move the stopLoading() call from the inner
.finally() block to an outer .finally() block at the end of the entire promise
chain, so it executes regardless of whether the putRequest or subsequent
Promise.all operations succeed or fail.
🪄 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: 506f0181-cdcb-423b-a046-3729b1f92efb
📒 Files selected for processing (4)
src/actions/inventory-item-actions.jssrc/actions/page-template-actions.jssrc/actions/sponsor-actions.jssrc/pages/sponsors-global/page-templates/page-template-list-page.js
💤 Files with no reviewable changes (1)
- src/actions/page-template-actions.js
🚧 Files skipped from review as they are similar to previous changes (1)
- src/pages/sponsors-global/page-templates/page-template-list-page.js
There was a problem hiding this comment.
Pull request overview
This PR standardizes “popup/dialog save” behavior across the admin UI by having save handlers return promises, moving “isSaving” state into the popup components to prevent duplicate submissions/closure during saves, and refreshing lists after successful saves.
Changes:
- Refactored multiple page-level
handleSave*functions to return promise chains and refresh list data after saves. - Updated several dialogs/popups to manage
isSavinglocally and disable close/escape/save while saving. - Updated tests and selected Redux actions to better support async save flows (including improved error propagation for inventory saves).
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/pages/tags/tag-list-page.js | Returns the refresh promise from tag save flow. |
| src/pages/sponsorship-types/sponsorship-list-page.js | Removes page-level isSaving; save handler now returns a promise for dialog-managed closing. |
| src/pages/sponsorship-types/components/sponsorship-dialog.js | Adds local isSaving gating and closes only after save promise resolves. |
| src/pages/sponsorship-types/tests/sponsorship-list-page.test.js | Updates mocked save to match new promise-based close flow. |
| src/pages/sponsors/summit-sponsorship-list-page.js | Refreshes list after tier save and renders popup conditionally (no open prop). |
| src/pages/sponsors/sponsor-page/tabs/sponsor-pages-tab/index.js | Refactors multiple save handlers to return promises and refresh lists. |
| src/pages/sponsors/sponsor-page/tabs/sponsor-pages-tab/components/add-sponsor-page-template-popup/index.js | Adds isSaving and disables close interactions while saving; closes on fulfilled save. |
| src/pages/sponsors/sponsor-page/tabs/sponsor-pages-tab/tests/sponsor-pages-tab.test.js | Updates mocked save to match promise-based close flow. |
| src/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/components/manage-items/sponsor-forms-manage-items.js | Returns promise from item save so the inventory dialog can close itself on success. |
| src/pages/sponsors/sponsor-list-page.js | Removes open prop usage and returns promise from add-sponsor save flow. |
| src/pages/sponsors/show-pages-list-page/index.js | Resets pagination on per-page/archive changes; returns save promise and refreshes list with current filters. |
| src/pages/sponsors/show-pages-list-page/tests/show-pages-list-page.test.js | Updates mocked save to match promise-based close flow. |
| src/pages/sponsors/popup/edit-tier-popup.js | Moves isSaving into dialog; disables close interactions and closes on fulfilled save. |
| src/pages/sponsors/popup/add-sponsor-popup.js | Moves isSaving into dialog; disables close interactions and closes on fulfilled save. |
| src/pages/sponsors-global/page-templates/page-template-popup/index.js | Adds isSaving UX and closes on fulfilled save. |
| src/pages/sponsors-global/page-templates/page-template-list-page.js | Refreshes page templates list after save instead of closing immediately. |
| src/pages/sponsors-global/inventory/inventory-list-page.js | Returns promise chain from inventory save and refreshes list after save. |
| src/pages/sponsors-global/form-templates/sponsor-inventory-popup.js | Adds isSaving UX and closes on fulfilled save. |
| src/pages/sponsors-global/form-templates/form-template-popup.js | Adjusts save flow to rely on promise-returning onSave. |
| src/pages/sponsors-global/form-templates/form-template-list-page.js | Refactors save handler to return promise and refresh list. |
| src/pages/sponsors-global/form-templates/form-template-item-list-page.js | Refactors item save handler to return promise and refresh list. |
| src/actions/sponsor-actions.js | Ensures saveSummitSponsorship returns request promises. |
| src/actions/page-template-actions.js | Removes auto-refresh side effect from action (callers now refresh). |
| src/actions/inventory-item-actions.js | Improves error propagation by rethrowing after logging and returning the inner promise chain. |
Comments suppressed due to low confidence (2)
src/actions/page-template-actions.js:180
- This
catchlogs the error but resolves the returned promise. Since popups now close only on fulfilled saves (via.then(() => onClose())), swallowing the rejection will cause the UI to close even when the API call fails. Re-throw after logging so callers can keep the dialog open on failure.
);
})
.catch((err) => {
console.error(err);
})
src/actions/page-template-actions.js:204
- Same as above: this
catchswallows errors, which will make callers treat a failed create as success and close the popup. Re-throw so the promise rejects on failure.
);
})
.catch((err) => {
console.error(err);
})
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
949a98f to
ecb120e
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (8)
src/pages/sponsors/sponsor-page/tabs/sponsor-general-form/add-tier-popup.js (1)
130-141: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winNo guard against duplicate tier-add submissions.
The submit button is only disabled by form validity, not by an in-flight save, so rapid clicks can fire multiple
onSubmitcalls.🤖 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/sponsors/sponsor-page/tabs/sponsor-general-form/add-tier-popup.js` around lines 130 - 141, Update the add-tier submit Button to also disable while the form submission is in flight, using Formik’s submitting state alongside the existing company and sponsorship validation checks. Ensure rapid clicks cannot trigger duplicate onSubmit calls.src/pages/sponsors/sponsor-form-item-list-page/components/sponsor-form-add-item-from-inventory-popup.js (2)
216-223: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winNo guard against duplicate "Add" submissions.
The Add button stays enabled while
addInventoryItemsis pending, allowing duplicate add requests on repeated clicks.🤖 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/sponsors/sponsor-form-item-list-page/components/sponsor-form-add-item-from-inventory-popup.js` around lines 216 - 223, Update the Add Button’s disabled condition in the sponsor inventory popup to also disable while addInventoryItems is pending, preventing repeated submissions; preserve the existing selectedRows.length === 0 guard.
51-55: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winKeep the popup open on add failure.
addInventoryItems()resolves even on errors here, so thisfinally()closes and resets the dialog when the request fails. MovehandleClose()into the success path.🤖 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/sponsors/sponsor-form-item-list-page/components/sponsor-form-add-item-from-inventory-popup.js` around lines 51 - 55, Update handleOnAdd so handleClose runs only after addInventoryItems completes successfully, rather than in finally. Preserve the existing addInventoryItems(formId, selectedRows) call and keep the popup open when the operation reports a failure.src/pages/sponsors-global/form-templates/form-template-from-duplicate-popup.js (2)
162-171: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick winNo guard against duplicate
onDuplicatesubmissions.The duplicate button is only gated on
!selectedRow, not on an in-flightonDuplicatecall, so repeated clicks can trigger duplicate operations.🤖 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/sponsors-global/form-templates/form-template-from-duplicate-popup.js` around lines 162 - 171, Update the duplicate button’s disabled condition in the form-template duplicate popup to also disable while handleOnDuplicate is in flight, preventing repeated submissions. Reuse the existing loading or submission state associated with handleOnDuplicate, and preserve the current !selectedRow guard.
39-41: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winFix
handleSortto pass the sort args directly
onSort(_, key, dir)references an undefined_, so selecting a sort option throws and sorting stops. Pass the callback arguments through without_.Suggested fix
- onSort(_, key, dir); + onSort(key, dir);🤖 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/sponsors-global/form-templates/form-template-from-duplicate-popup.js` around lines 39 - 41, Update handleSort to invoke onSort with only the key and direction arguments, removing the undefined _ argument so selecting a sort option works correctly.src/pages/sponsors/sponsor-page/tabs/sponsor-users-list-per-sponsor/components/import-users-popup.js (1)
69-78: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winNo guard against duplicate
handleImportsubmissions.The Import button stays enabled while
importSponsorUsersis in flight, so a user can trigger multiple concurrent import requests.Also applies to: 138-145
🤖 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/sponsors/sponsor-page/tabs/sponsor-users-list-per-sponsor/components/import-users-popup.js` around lines 69 - 78, Update handleImport to prevent duplicate submissions while importSponsorUsers is in flight by tracking an in-progress state and disabling the Import button until the request settles. Ensure the state resets on both success and failure, while preserving the existing onClose behavior after a successful import.src/pages/sponsors/sponsor-page/tabs/sponsor-users-list-per-sponsor/components/process-request-popup.js (1)
38-68: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winNo guard against duplicate admit/deny submissions.
Neither
handleAdmitnorhandleDeletedisable their buttons while the approve/deny request is pending, allowing duplicate submissions on repeated clicks.Also applies to: 118-136
🤖 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/sponsors/sponsor-page/tabs/sponsor-users-list-per-sponsor/components/process-request-popup.js` around lines 38 - 68, The handleAdmit and handleDelete flows allow repeated submissions while approveSponsorUserRequest or denySponsorUserRequest is pending. Add a shared or per-action pending state, disable the corresponding admit/deny buttons during the request, and clear the state after completion so duplicate clicks are ignored while preserving handleClose behavior.src/actions/inventory-item-actions.js (1)
259-297: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winCreate branch still doesn't propagate/await dependent-save failures — same gap flagged previously for the sibling update branch.
Promise.all(promises)at line 279 is not returned from the.then(({ response }) => {...})callback (line 267). The rethrow added at line 289 only throws inside this now-detached chain; since nothing follows the.finally()at 291-293, this becomes an unhandled rejection rather than propagating to the outer.catch(). Consequences:
- The outer chain resolves regardless of whether
saveItemImages/saveItemMetaFieldTypessucceed, so callers using the new "await save, then close" contract will treat a failed create as successful.- If the initial
postRequestitself fails (outer.catch()at 295-297),stopLoading()is never dispatched, since it only lives inside the detached inner chain's.finally().This mirrors the exact fix already applied to the update branch above (return the promise, rethrow, and put
stopLoading()in an outer.finally()).🐛 Proposed fix (mirrors update-branch pattern)
return postRequest( createAction(ADD_INVENTORY_ITEM), createAction(INVENTORY_ITEM_ADDED), `${window.INVENTORY_API_BASE_URL}/api/v1/inventory-items`, normalizedEntity, authErrorHandler, entity )(params)(dispatch) .then(({ response }) => { const inventoryItem = { ...normalizedEntity, id: response.id }; const promises = []; if (entity.images.length > 0) { promises.push(saveItemImages(inventoryItem)(dispatch)); } if (entity.meta_fields.length > 0) { promises.push(saveItemMetaFieldTypes(inventoryItem)(dispatch)); } - Promise.all(promises) - .then(() => { - dispatch( - showMessage(success_message, () => { - history.push("/app/inventory"); - }) - ); - }) - .catch((err) => { - console.error(err); - throw err; - }) - .finally(() => { - dispatch(stopLoading()); - }); + return Promise.all(promises).then(() => { + dispatch( + showMessage(success_message, () => { + history.push("/app/inventory"); + }) + ); + }); }) .catch((err) => { console.error(err); + throw err; + }) + .finally(() => { + dispatch(stopLoading()); }); };🤖 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/actions/inventory-item-actions.js` around lines 259 - 297, Update the create branch’s promise chain around postRequest so the dependent-save Promise.all flow is returned from the response callback, allowing failures to reach the outer catch and callers to await completion. Move stopLoading() into an outer finally that runs for both request and dependent-save failures, while preserving the existing error logging and success navigation behavior.
🤖 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/inventory-item-actions.js`:
- Around line 371-394: Update the archiveInventoryItem thunk’s catch block
around archiveItem to rethrow the caught error instead of returning undefined,
preserving the rejected promise for failed archive requests. Apply the same
failure-propagation behavior to the corresponding unarchive thunk if it contains
the same catch pattern.
In `@src/pages/sponsors-global/form-templates/form-template-list-page.js`:
- Around line 142-145: Update handleCloseFormTemplateDialog to reset
formTemplateDuplicate to false when closing the dialog, alongside
resetFormTemplateForm and setFormTemplatePopupOpen, so subsequent normal create
dialogs do not receive toDuplicate={true}.
---
Outside diff comments:
In `@src/actions/inventory-item-actions.js`:
- Around line 259-297: Update the create branch’s promise chain around
postRequest so the dependent-save Promise.all flow is returned from the response
callback, allowing failures to reach the outer catch and callers to await
completion. Move stopLoading() into an outer finally that runs for both request
and dependent-save failures, while preserving the existing error logging and
success navigation behavior.
In
`@src/pages/sponsors-global/form-templates/form-template-from-duplicate-popup.js`:
- Around line 162-171: Update the duplicate button’s disabled condition in the
form-template duplicate popup to also disable while handleOnDuplicate is in
flight, preventing repeated submissions. Reuse the existing loading or
submission state associated with handleOnDuplicate, and preserve the current
!selectedRow guard.
- Around line 39-41: Update handleSort to invoke onSort with only the key and
direction arguments, removing the undefined _ argument so selecting a sort
option works correctly.
In
`@src/pages/sponsors/sponsor-form-item-list-page/components/sponsor-form-add-item-from-inventory-popup.js`:
- Around line 216-223: Update the Add Button’s disabled condition in the sponsor
inventory popup to also disable while addInventoryItems is pending, preventing
repeated submissions; preserve the existing selectedRows.length === 0 guard.
- Around line 51-55: Update handleOnAdd so handleClose runs only after
addInventoryItems completes successfully, rather than in finally. Preserve the
existing addInventoryItems(formId, selectedRows) call and keep the popup open
when the operation reports a failure.
In `@src/pages/sponsors/sponsor-page/tabs/sponsor-general-form/add-tier-popup.js`:
- Around line 130-141: Update the add-tier submit Button to also disable while
the form submission is in flight, using Formik’s submitting state alongside the
existing company and sponsorship validation checks. Ensure rapid clicks cannot
trigger duplicate onSubmit calls.
In
`@src/pages/sponsors/sponsor-page/tabs/sponsor-users-list-per-sponsor/components/import-users-popup.js`:
- Around line 69-78: Update handleImport to prevent duplicate submissions while
importSponsorUsers is in flight by tracking an in-progress state and disabling
the Import button until the request settles. Ensure the state resets on both
success and failure, while preserving the existing onClose behavior after a
successful import.
In
`@src/pages/sponsors/sponsor-page/tabs/sponsor-users-list-per-sponsor/components/process-request-popup.js`:
- Around line 38-68: The handleAdmit and handleDelete flows allow repeated
submissions while approveSponsorUserRequest or denySponsorUserRequest is
pending. Add a shared or per-action pending state, disable the corresponding
admit/deny buttons during the request, and clear the state after completion so
duplicate clicks are ignored while preserving handleClose behavior.
🪄 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: 96910344-c534-4c16-ba13-eeaa4d80cc0a
📒 Files selected for processing (49)
src/actions/inventory-item-actions.jssrc/actions/page-template-actions.jssrc/actions/sponsor-actions.jssrc/pages/sponsors-global/form-templates/form-template-from-duplicate-popup.jssrc/pages/sponsors-global/form-templates/form-template-item-list-page.jssrc/pages/sponsors-global/form-templates/form-template-list-page.jssrc/pages/sponsors-global/form-templates/form-template-popup.jssrc/pages/sponsors-global/form-templates/sponsor-inventory-popup.jssrc/pages/sponsors-global/inventory/inventory-list-page.jssrc/pages/sponsors-global/page-templates/page-template-list-page.jssrc/pages/sponsors-global/page-templates/page-template-popup/index.jssrc/pages/sponsors/popup/add-sponsor-popup.jssrc/pages/sponsors/popup/edit-tier-popup.jssrc/pages/sponsors/show-pages-list-page/__tests__/show-pages-list-page.test.jssrc/pages/sponsors/show-pages-list-page/index.jssrc/pages/sponsors/sponsor-form-item-list-page/components/__test__/inventory-popup.test.jssrc/pages/sponsors/sponsor-form-item-list-page/components/sponsor-form-add-item-from-inventory-popup.jssrc/pages/sponsors/sponsor-form-item-list-page/components/sponsor-form-item-popup.jssrc/pages/sponsors/sponsor-form-item-list-page/index.jssrc/pages/sponsors/sponsor-forms-list-page/components/form-template/form-template-popup.jssrc/pages/sponsors/sponsor-forms-list-page/components/global-template/global-template-popup.jssrc/pages/sponsors/sponsor-forms-list-page/index.jssrc/pages/sponsors/sponsor-list-page.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-badge-scans/edit-badge-scan-popup.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-badge-scans/index.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-cart-tab/components/select-form-dialog/__tests__/select-form-dialog.test.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-cart-tab/components/select-form-dialog/index.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-cart-tab/index.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/components/customized-form/__tests__/customized-form-popup.test.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/components/customized-form/customized-form-popup.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/components/manage-items/sponsor-forms-manage-items.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/index.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-general-form/add-extra-question-popup.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-general-form/add-tier-popup.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-general-form/extra-questions.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-general-form/manage-tier-addons-popup.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-general-form/sponsorship.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-pages-tab/__tests__/sponsor-pages-tab.test.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-pages-tab/components/add-sponsor-page-template-popup/index.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-pages-tab/index.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-users-list-per-sponsor/components/import-users-popup.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-users-list-per-sponsor/components/new-user-popup.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-users-list-per-sponsor/components/process-request-popup.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-users-list-per-sponsor/index.jssrc/pages/sponsors/summit-sponsorship-list-page.jssrc/pages/sponsorship-types/__tests__/sponsorship-list-page.test.jssrc/pages/sponsorship-types/components/sponsorship-dialog.jssrc/pages/sponsorship-types/sponsorship-list-page.jssrc/pages/tags/tag-list-page.js
💤 Files with no reviewable changes (6)
- src/pages/sponsors/sponsor-page/tabs/sponsor-general-form/extra-questions.js
- src/pages/sponsors/sponsor-page/tabs/sponsor-cart-tab/components/select-form-dialog/tests/select-form-dialog.test.js
- src/pages/sponsors/sponsor-page/tabs/sponsor-badge-scans/index.js
- src/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/components/customized-form/tests/customized-form-popup.test.js
- src/pages/sponsors/sponsor-page/tabs/sponsor-general-form/sponsorship.js
- src/pages/sponsors/sponsor-page/tabs/sponsor-users-list-per-sponsor/index.js
🚧 Files skipped from review as they are similar to previous changes (20)
- src/pages/sponsors/summit-sponsorship-list-page.js
- src/pages/tags/tag-list-page.js
- src/pages/sponsors-global/inventory/inventory-list-page.js
- src/pages/sponsors-global/page-templates/page-template-list-page.js
- src/pages/sponsorship-types/tests/sponsorship-list-page.test.js
- src/pages/sponsors/sponsor-page/tabs/sponsor-pages-tab/index.js
- src/pages/sponsors-global/form-templates/form-template-item-list-page.js
- src/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/components/manage-items/sponsor-forms-manage-items.js
- src/pages/sponsorship-types/components/sponsorship-dialog.js
- src/pages/sponsors-global/form-templates/sponsor-inventory-popup.js
- src/pages/sponsors/show-pages-list-page/tests/show-pages-list-page.test.js
- src/pages/sponsors/sponsor-list-page.js
- src/pages/sponsors/sponsor-page/tabs/sponsor-pages-tab/components/add-sponsor-page-template-popup/index.js
- src/actions/page-template-actions.js
- src/pages/sponsors-global/page-templates/page-template-popup/index.js
- src/pages/sponsorship-types/sponsorship-list-page.js
- src/pages/sponsors/popup/edit-tier-popup.js
- src/actions/sponsor-actions.js
- src/pages/sponsors/popup/add-sponsor-popup.js
- src/pages/sponsors-global/form-templates/form-template-popup.js
There was a problem hiding this comment.
Caution
Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (8)
src/pages/sponsors/sponsor-page/tabs/sponsor-general-form/add-tier-popup.js (1)
130-141: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winNo guard against duplicate tier-add submissions.
The submit button is only disabled by form validity, not by an in-flight save, so rapid clicks can fire multiple
onSubmitcalls.🤖 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/sponsors/sponsor-page/tabs/sponsor-general-form/add-tier-popup.js` around lines 130 - 141, Update the add-tier submit Button to also disable while the form submission is in flight, using Formik’s submitting state alongside the existing company and sponsorship validation checks. Ensure rapid clicks cannot trigger duplicate onSubmit calls.src/pages/sponsors/sponsor-form-item-list-page/components/sponsor-form-add-item-from-inventory-popup.js (2)
216-223: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winNo guard against duplicate "Add" submissions.
The Add button stays enabled while
addInventoryItemsis pending, allowing duplicate add requests on repeated clicks.🤖 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/sponsors/sponsor-form-item-list-page/components/sponsor-form-add-item-from-inventory-popup.js` around lines 216 - 223, Update the Add Button’s disabled condition in the sponsor inventory popup to also disable while addInventoryItems is pending, preventing repeated submissions; preserve the existing selectedRows.length === 0 guard.
51-55: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winKeep the popup open on add failure.
addInventoryItems()resolves even on errors here, so thisfinally()closes and resets the dialog when the request fails. MovehandleClose()into the success path.🤖 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/sponsors/sponsor-form-item-list-page/components/sponsor-form-add-item-from-inventory-popup.js` around lines 51 - 55, Update handleOnAdd so handleClose runs only after addInventoryItems completes successfully, rather than in finally. Preserve the existing addInventoryItems(formId, selectedRows) call and keep the popup open when the operation reports a failure.src/pages/sponsors-global/form-templates/form-template-from-duplicate-popup.js (2)
162-171: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick winNo guard against duplicate
onDuplicatesubmissions.The duplicate button is only gated on
!selectedRow, not on an in-flightonDuplicatecall, so repeated clicks can trigger duplicate operations.🤖 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/sponsors-global/form-templates/form-template-from-duplicate-popup.js` around lines 162 - 171, Update the duplicate button’s disabled condition in the form-template duplicate popup to also disable while handleOnDuplicate is in flight, preventing repeated submissions. Reuse the existing loading or submission state associated with handleOnDuplicate, and preserve the current !selectedRow guard.
39-41: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winFix
handleSortto pass the sort args directly
onSort(_, key, dir)references an undefined_, so selecting a sort option throws and sorting stops. Pass the callback arguments through without_.Suggested fix
- onSort(_, key, dir); + onSort(key, dir);🤖 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/sponsors-global/form-templates/form-template-from-duplicate-popup.js` around lines 39 - 41, Update handleSort to invoke onSort with only the key and direction arguments, removing the undefined _ argument so selecting a sort option works correctly.src/pages/sponsors/sponsor-page/tabs/sponsor-users-list-per-sponsor/components/import-users-popup.js (1)
69-78: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winNo guard against duplicate
handleImportsubmissions.The Import button stays enabled while
importSponsorUsersis in flight, so a user can trigger multiple concurrent import requests.Also applies to: 138-145
🤖 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/sponsors/sponsor-page/tabs/sponsor-users-list-per-sponsor/components/import-users-popup.js` around lines 69 - 78, Update handleImport to prevent duplicate submissions while importSponsorUsers is in flight by tracking an in-progress state and disabling the Import button until the request settles. Ensure the state resets on both success and failure, while preserving the existing onClose behavior after a successful import.src/pages/sponsors/sponsor-page/tabs/sponsor-users-list-per-sponsor/components/process-request-popup.js (1)
38-68: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winNo guard against duplicate admit/deny submissions.
Neither
handleAdmitnorhandleDeletedisable their buttons while the approve/deny request is pending, allowing duplicate submissions on repeated clicks.Also applies to: 118-136
🤖 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/sponsors/sponsor-page/tabs/sponsor-users-list-per-sponsor/components/process-request-popup.js` around lines 38 - 68, The handleAdmit and handleDelete flows allow repeated submissions while approveSponsorUserRequest or denySponsorUserRequest is pending. Add a shared or per-action pending state, disable the corresponding admit/deny buttons during the request, and clear the state after completion so duplicate clicks are ignored while preserving handleClose behavior.src/actions/inventory-item-actions.js (1)
259-297: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winCreate branch still doesn't propagate/await dependent-save failures — same gap flagged previously for the sibling update branch.
Promise.all(promises)at line 279 is not returned from the.then(({ response }) => {...})callback (line 267). The rethrow added at line 289 only throws inside this now-detached chain; since nothing follows the.finally()at 291-293, this becomes an unhandled rejection rather than propagating to the outer.catch(). Consequences:
- The outer chain resolves regardless of whether
saveItemImages/saveItemMetaFieldTypessucceed, so callers using the new "await save, then close" contract will treat a failed create as successful.- If the initial
postRequestitself fails (outer.catch()at 295-297),stopLoading()is never dispatched, since it only lives inside the detached inner chain's.finally().This mirrors the exact fix already applied to the update branch above (return the promise, rethrow, and put
stopLoading()in an outer.finally()).🐛 Proposed fix (mirrors update-branch pattern)
return postRequest( createAction(ADD_INVENTORY_ITEM), createAction(INVENTORY_ITEM_ADDED), `${window.INVENTORY_API_BASE_URL}/api/v1/inventory-items`, normalizedEntity, authErrorHandler, entity )(params)(dispatch) .then(({ response }) => { const inventoryItem = { ...normalizedEntity, id: response.id }; const promises = []; if (entity.images.length > 0) { promises.push(saveItemImages(inventoryItem)(dispatch)); } if (entity.meta_fields.length > 0) { promises.push(saveItemMetaFieldTypes(inventoryItem)(dispatch)); } - Promise.all(promises) - .then(() => { - dispatch( - showMessage(success_message, () => { - history.push("/app/inventory"); - }) - ); - }) - .catch((err) => { - console.error(err); - throw err; - }) - .finally(() => { - dispatch(stopLoading()); - }); + return Promise.all(promises).then(() => { + dispatch( + showMessage(success_message, () => { + history.push("/app/inventory"); + }) + ); + }); }) .catch((err) => { console.error(err); + throw err; + }) + .finally(() => { + dispatch(stopLoading()); }); };🤖 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/actions/inventory-item-actions.js` around lines 259 - 297, Update the create branch’s promise chain around postRequest so the dependent-save Promise.all flow is returned from the response callback, allowing failures to reach the outer catch and callers to await completion. Move stopLoading() into an outer finally that runs for both request and dependent-save failures, while preserving the existing error logging and success navigation behavior.
🤖 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/inventory-item-actions.js`:
- Around line 371-394: Update the archiveInventoryItem thunk’s catch block
around archiveItem to rethrow the caught error instead of returning undefined,
preserving the rejected promise for failed archive requests. Apply the same
failure-propagation behavior to the corresponding unarchive thunk if it contains
the same catch pattern.
In `@src/pages/sponsors-global/form-templates/form-template-list-page.js`:
- Around line 142-145: Update handleCloseFormTemplateDialog to reset
formTemplateDuplicate to false when closing the dialog, alongside
resetFormTemplateForm and setFormTemplatePopupOpen, so subsequent normal create
dialogs do not receive toDuplicate={true}.
---
Outside diff comments:
In `@src/actions/inventory-item-actions.js`:
- Around line 259-297: Update the create branch’s promise chain around
postRequest so the dependent-save Promise.all flow is returned from the response
callback, allowing failures to reach the outer catch and callers to await
completion. Move stopLoading() into an outer finally that runs for both request
and dependent-save failures, while preserving the existing error logging and
success navigation behavior.
In
`@src/pages/sponsors-global/form-templates/form-template-from-duplicate-popup.js`:
- Around line 162-171: Update the duplicate button’s disabled condition in the
form-template duplicate popup to also disable while handleOnDuplicate is in
flight, preventing repeated submissions. Reuse the existing loading or
submission state associated with handleOnDuplicate, and preserve the current
!selectedRow guard.
- Around line 39-41: Update handleSort to invoke onSort with only the key and
direction arguments, removing the undefined _ argument so selecting a sort
option works correctly.
In
`@src/pages/sponsors/sponsor-form-item-list-page/components/sponsor-form-add-item-from-inventory-popup.js`:
- Around line 216-223: Update the Add Button’s disabled condition in the sponsor
inventory popup to also disable while addInventoryItems is pending, preventing
repeated submissions; preserve the existing selectedRows.length === 0 guard.
- Around line 51-55: Update handleOnAdd so handleClose runs only after
addInventoryItems completes successfully, rather than in finally. Preserve the
existing addInventoryItems(formId, selectedRows) call and keep the popup open
when the operation reports a failure.
In `@src/pages/sponsors/sponsor-page/tabs/sponsor-general-form/add-tier-popup.js`:
- Around line 130-141: Update the add-tier submit Button to also disable while
the form submission is in flight, using Formik’s submitting state alongside the
existing company and sponsorship validation checks. Ensure rapid clicks cannot
trigger duplicate onSubmit calls.
In
`@src/pages/sponsors/sponsor-page/tabs/sponsor-users-list-per-sponsor/components/import-users-popup.js`:
- Around line 69-78: Update handleImport to prevent duplicate submissions while
importSponsorUsers is in flight by tracking an in-progress state and disabling
the Import button until the request settles. Ensure the state resets on both
success and failure, while preserving the existing onClose behavior after a
successful import.
In
`@src/pages/sponsors/sponsor-page/tabs/sponsor-users-list-per-sponsor/components/process-request-popup.js`:
- Around line 38-68: The handleAdmit and handleDelete flows allow repeated
submissions while approveSponsorUserRequest or denySponsorUserRequest is
pending. Add a shared or per-action pending state, disable the corresponding
admit/deny buttons during the request, and clear the state after completion so
duplicate clicks are ignored while preserving handleClose behavior.
🪄 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: 96910344-c534-4c16-ba13-eeaa4d80cc0a
📒 Files selected for processing (49)
src/actions/inventory-item-actions.jssrc/actions/page-template-actions.jssrc/actions/sponsor-actions.jssrc/pages/sponsors-global/form-templates/form-template-from-duplicate-popup.jssrc/pages/sponsors-global/form-templates/form-template-item-list-page.jssrc/pages/sponsors-global/form-templates/form-template-list-page.jssrc/pages/sponsors-global/form-templates/form-template-popup.jssrc/pages/sponsors-global/form-templates/sponsor-inventory-popup.jssrc/pages/sponsors-global/inventory/inventory-list-page.jssrc/pages/sponsors-global/page-templates/page-template-list-page.jssrc/pages/sponsors-global/page-templates/page-template-popup/index.jssrc/pages/sponsors/popup/add-sponsor-popup.jssrc/pages/sponsors/popup/edit-tier-popup.jssrc/pages/sponsors/show-pages-list-page/__tests__/show-pages-list-page.test.jssrc/pages/sponsors/show-pages-list-page/index.jssrc/pages/sponsors/sponsor-form-item-list-page/components/__test__/inventory-popup.test.jssrc/pages/sponsors/sponsor-form-item-list-page/components/sponsor-form-add-item-from-inventory-popup.jssrc/pages/sponsors/sponsor-form-item-list-page/components/sponsor-form-item-popup.jssrc/pages/sponsors/sponsor-form-item-list-page/index.jssrc/pages/sponsors/sponsor-forms-list-page/components/form-template/form-template-popup.jssrc/pages/sponsors/sponsor-forms-list-page/components/global-template/global-template-popup.jssrc/pages/sponsors/sponsor-forms-list-page/index.jssrc/pages/sponsors/sponsor-list-page.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-badge-scans/edit-badge-scan-popup.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-badge-scans/index.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-cart-tab/components/select-form-dialog/__tests__/select-form-dialog.test.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-cart-tab/components/select-form-dialog/index.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-cart-tab/index.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/components/customized-form/__tests__/customized-form-popup.test.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/components/customized-form/customized-form-popup.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/components/manage-items/sponsor-forms-manage-items.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/index.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-general-form/add-extra-question-popup.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-general-form/add-tier-popup.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-general-form/extra-questions.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-general-form/manage-tier-addons-popup.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-general-form/sponsorship.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-pages-tab/__tests__/sponsor-pages-tab.test.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-pages-tab/components/add-sponsor-page-template-popup/index.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-pages-tab/index.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-users-list-per-sponsor/components/import-users-popup.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-users-list-per-sponsor/components/new-user-popup.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-users-list-per-sponsor/components/process-request-popup.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-users-list-per-sponsor/index.jssrc/pages/sponsors/summit-sponsorship-list-page.jssrc/pages/sponsorship-types/__tests__/sponsorship-list-page.test.jssrc/pages/sponsorship-types/components/sponsorship-dialog.jssrc/pages/sponsorship-types/sponsorship-list-page.jssrc/pages/tags/tag-list-page.js
💤 Files with no reviewable changes (6)
- src/pages/sponsors/sponsor-page/tabs/sponsor-general-form/extra-questions.js
- src/pages/sponsors/sponsor-page/tabs/sponsor-cart-tab/components/select-form-dialog/tests/select-form-dialog.test.js
- src/pages/sponsors/sponsor-page/tabs/sponsor-badge-scans/index.js
- src/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/components/customized-form/tests/customized-form-popup.test.js
- src/pages/sponsors/sponsor-page/tabs/sponsor-general-form/sponsorship.js
- src/pages/sponsors/sponsor-page/tabs/sponsor-users-list-per-sponsor/index.js
🚧 Files skipped from review as they are similar to previous changes (20)
- src/pages/sponsors/summit-sponsorship-list-page.js
- src/pages/tags/tag-list-page.js
- src/pages/sponsors-global/inventory/inventory-list-page.js
- src/pages/sponsors-global/page-templates/page-template-list-page.js
- src/pages/sponsorship-types/tests/sponsorship-list-page.test.js
- src/pages/sponsors/sponsor-page/tabs/sponsor-pages-tab/index.js
- src/pages/sponsors-global/form-templates/form-template-item-list-page.js
- src/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/components/manage-items/sponsor-forms-manage-items.js
- src/pages/sponsorship-types/components/sponsorship-dialog.js
- src/pages/sponsors-global/form-templates/sponsor-inventory-popup.js
- src/pages/sponsors/show-pages-list-page/tests/show-pages-list-page.test.js
- src/pages/sponsors/sponsor-list-page.js
- src/pages/sponsors/sponsor-page/tabs/sponsor-pages-tab/components/add-sponsor-page-template-popup/index.js
- src/actions/page-template-actions.js
- src/pages/sponsors-global/page-templates/page-template-popup/index.js
- src/pages/sponsorship-types/sponsorship-list-page.js
- src/pages/sponsors/popup/edit-tier-popup.js
- src/actions/sponsor-actions.js
- src/pages/sponsors/popup/add-sponsor-popup.js
- src/pages/sponsors-global/form-templates/form-template-popup.js
🛑 Comments failed to post (2)
src/actions/inventory-item-actions.js (1)
371-394: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash rg -n "export const archiveItem|export const unarchiveItem" -g '*.js' -A20Repository: fntechgit/summit-admin
Length of output: 160
🏁 Script executed:
#!/bin/bash set -euo pipefail # Locate the relevant action helpers and surrounding implementations. git ls-files | rg 'src/.+\.js$|src/.+\.ts$' | rg 'inventory-item-actions|archiveItem|unarchiveItem|putRequest|deleteRequest|authErrorHandler' # Show concise file maps for the likely source files. for f in $(git ls-files | rg 'inventory-item-actions|putRequest|deleteRequest|authErrorHandler'); do echo "### $f" wc -l "$f" doneRepository: fntechgit/summit-admin
Length of output: 282
🏁 Script executed:
#!/bin/bash set -euo pipefail # Map the action file and inspect the relevant range. ast-grep outline src/actions/inventory-item-actions.js --view expanded || true sed -n '320,419p' src/actions/inventory-item-actions.js # Find the helper definitions and their error-handling paths. rg -n "archiveItem|unarchiveItem|putRequest|deleteRequest|authErrorHandler|error toast|toast|reject" src/actions -A25 -B10Repository: fntechgit/summit-admin
Length of output: 50379
🏁 Script executed:
#!/bin/bash set -euo pipefail # Inspect the inventory item action file and its imports. sed -n '1,220p' src/actions/inventory-item-actions.js sed -n '220,420p' src/actions/inventory-item-actions.js # Find where archive/unarchive helpers come from and how they are used elsewhere. rg -n "archiveItem|unarchiveItem" src package.json yarn.lock package-lock.json pnpm-lock.yaml -A3 -B3Repository: fntechgit/summit-admin
Length of output: 18657
🏁 Script executed:
#!/bin/bash set -euo pipefail # Inspect the shared archive helpers. sed -n '260,340p' src/actions/inventory-shared-actions.js # Inspect any local custom error handlers used around these request helpers. rg -n "authErrorHandler|snackbarErrorHandler|showSuccessMessage|showMessage|catch \\(e\\)|catch \\(err\\)" src/actions/inventory-shared-actions.js src/actions/*.js -A8 -B8Repository: fntechgit/summit-admin
Length of output: 50379
🏁 Script executed:
#!/bin/bash set -euo pipefail wc -l src/actions/inventory-shared-actions.js sed -n '280,330p' src/actions/inventory-shared-actions.jsRepository: fntechgit/summit-admin
Length of output: 1177
🏁 Script executed:
#!/bin/bash set -euo pipefail rg -n "archiveInventoryItem\\(|unarchiveInventoryItem\\(" src -A4 -B4Repository: fntechgit/summit-admin
Length of output: 982
Archive/unarchive thunks should rethrow failures. The shared request helpers already use
authErrorHandler, butcatch (e) { return undefined; }here turns a failed archive/unarchive into a resolved promise, so callers chaining.then()will treat it as success.🤖 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/actions/inventory-item-actions.js` around lines 371 - 394, Update the archiveInventoryItem thunk’s catch block around archiveItem to rethrow the caught error instead of returning undefined, preserving the rejected promise for failed archive requests. Apply the same failure-propagation behavior to the corresponding unarchive thunk if it contains the same catch pattern.src/pages/sponsors-global/form-templates/form-template-list-page.js (1)
142-145: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Reset duplicate mode when closing the edit dialog.
After a duplicate flow,
formTemplateDuplicateremainstrue; the next normal create dialog still receivestoDuplicate={true}on Line 343.Proposed fix
const handleCloseFormTemplateDialog = () => { resetFormTemplateForm(); + setFormTemplateDuplicate(false); setFormTemplatePopupOpen(false); };Also applies to: 338-344
🤖 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/sponsors-global/form-templates/form-template-list-page.js` around lines 142 - 145, Update handleCloseFormTemplateDialog to reset formTemplateDuplicate to false when closing the dialog, alongside resetFormTemplateForm and setFormTemplatePopupOpen, so subsequent normal create dialogs do not receive toDuplicate={true}.
…emove open prop, adjust tests 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>
Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
…it sponsorships Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
ba66863 to
ed52290
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/sponsors/sponsor-form-item-list-page/index.js`:
- Around line 304-315: Update the popup contract in the item-list page so the
callbacks passed to SponsorFormItemPopup and
SponsorFormAddItemFromInventoryPopup refresh via getSponsorFormItems using the
current pagination, sorting, and archive filters before closing. Ensure each
popup invokes onClose only after a successful save rather than from finally(),
so failed saves do not trigger an unnecessary refresh.
🪄 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: 0a101051-8abc-4cfe-b242-ca881071a510
📒 Files selected for processing (49)
src/actions/inventory-item-actions.jssrc/actions/page-template-actions.jssrc/actions/sponsor-actions.jssrc/pages/sponsors-global/form-templates/form-template-from-duplicate-popup.jssrc/pages/sponsors-global/form-templates/form-template-item-list-page.jssrc/pages/sponsors-global/form-templates/form-template-list-page.jssrc/pages/sponsors-global/form-templates/form-template-popup.jssrc/pages/sponsors-global/form-templates/sponsor-inventory-popup.jssrc/pages/sponsors-global/inventory/inventory-list-page.jssrc/pages/sponsors-global/page-templates/page-template-list-page.jssrc/pages/sponsors-global/page-templates/page-template-popup/index.jssrc/pages/sponsors/popup/add-sponsor-popup.jssrc/pages/sponsors/popup/edit-tier-popup.jssrc/pages/sponsors/show-pages-list-page/__tests__/show-pages-list-page.test.jssrc/pages/sponsors/show-pages-list-page/index.jssrc/pages/sponsors/sponsor-form-item-list-page/components/__test__/inventory-popup.test.jssrc/pages/sponsors/sponsor-form-item-list-page/components/sponsor-form-add-item-from-inventory-popup.jssrc/pages/sponsors/sponsor-form-item-list-page/components/sponsor-form-item-popup.jssrc/pages/sponsors/sponsor-form-item-list-page/index.jssrc/pages/sponsors/sponsor-forms-list-page/components/form-template/form-template-popup.jssrc/pages/sponsors/sponsor-forms-list-page/components/global-template/global-template-popup.jssrc/pages/sponsors/sponsor-forms-list-page/index.jssrc/pages/sponsors/sponsor-list-page.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-badge-scans/edit-badge-scan-popup.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-badge-scans/index.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-cart-tab/components/select-form-dialog/__tests__/select-form-dialog.test.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-cart-tab/components/select-form-dialog/index.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-cart-tab/index.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/components/customized-form/__tests__/customized-form-popup.test.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/components/customized-form/customized-form-popup.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/components/manage-items/sponsor-forms-manage-items.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/index.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-general-form/add-extra-question-popup.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-general-form/add-tier-popup.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-general-form/extra-questions.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-general-form/manage-tier-addons-popup.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-general-form/sponsorship.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-pages-tab/__tests__/sponsor-pages-tab.test.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-pages-tab/components/add-sponsor-page-template-popup/index.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-pages-tab/index.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-users-list-per-sponsor/components/import-users-popup.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-users-list-per-sponsor/components/new-user-popup.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-users-list-per-sponsor/components/process-request-popup.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-users-list-per-sponsor/index.jssrc/pages/sponsors/summit-sponsorship-list-page.jssrc/pages/sponsorship-types/__tests__/sponsorship-list-page.test.jssrc/pages/sponsorship-types/components/sponsorship-dialog.jssrc/pages/sponsorship-types/sponsorship-list-page.jssrc/pages/tags/tag-list-page.js
💤 Files with no reviewable changes (6)
- src/pages/sponsors/sponsor-page/tabs/sponsor-badge-scans/index.js
- src/pages/sponsors/sponsor-page/tabs/sponsor-general-form/extra-questions.js
- src/pages/sponsors/sponsor-page/tabs/sponsor-general-form/sponsorship.js
- src/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/components/customized-form/tests/customized-form-popup.test.js
- src/pages/sponsors/sponsor-page/tabs/sponsor-cart-tab/components/select-form-dialog/tests/select-form-dialog.test.js
- src/actions/page-template-actions.js
🚧 Files skipped from review as they are similar to previous changes (41)
- src/pages/sponsors/sponsor-forms-list-page/index.js
- src/pages/sponsors/summit-sponsorship-list-page.js
- src/pages/sponsors/sponsor-page/tabs/sponsor-users-list-per-sponsor/components/new-user-popup.js
- src/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/index.js
- src/pages/tags/tag-list-page.js
- src/pages/sponsors/sponsor-list-page.js
- src/pages/sponsors/show-pages-list-page/index.js
- src/pages/sponsors/sponsor-form-item-list-page/components/sponsor-form-add-item-from-inventory-popup.js
- src/pages/sponsors/sponsor-forms-list-page/components/form-template/form-template-popup.js
- src/pages/sponsors/show-pages-list-page/tests/show-pages-list-page.test.js
- src/pages/sponsors/sponsor-page/tabs/sponsor-general-form/manage-tier-addons-popup.js
- src/pages/sponsors/sponsor-page/tabs/sponsor-pages-tab/index.js
- src/pages/sponsors/sponsor-page/tabs/sponsor-users-list-per-sponsor/components/process-request-popup.js
- src/pages/sponsors/sponsor-page/tabs/sponsor-users-list-per-sponsor/components/import-users-popup.js
- src/pages/sponsors-global/inventory/inventory-list-page.js
- src/pages/sponsors-global/form-templates/form-template-from-duplicate-popup.js
- src/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/components/manage-items/sponsor-forms-manage-items.js
- src/pages/sponsors-global/form-templates/sponsor-inventory-popup.js
- src/pages/sponsorship-types/tests/sponsorship-list-page.test.js
- src/pages/sponsors/popup/add-sponsor-popup.js
- src/pages/sponsorship-types/components/sponsorship-dialog.js
- src/pages/sponsors/sponsor-form-item-list-page/components/sponsor-form-item-popup.js
- src/pages/sponsors-global/page-templates/page-template-list-page.js
- src/pages/sponsors-global/form-templates/form-template-item-list-page.js
- src/pages/sponsors/sponsor-page/tabs/sponsor-users-list-per-sponsor/index.js
- src/pages/sponsors/sponsor-page/tabs/sponsor-cart-tab/index.js
- src/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/components/customized-form/customized-form-popup.js
- src/pages/sponsorship-types/sponsorship-list-page.js
- src/pages/sponsors/sponsor-forms-list-page/components/global-template/global-template-popup.js
- src/pages/sponsors/sponsor-page/tabs/sponsor-general-form/add-tier-popup.js
- src/pages/sponsors-global/form-templates/form-template-list-page.js
- src/pages/sponsors/sponsor-page/tabs/sponsor-pages-tab/tests/sponsor-pages-tab.test.js
- src/pages/sponsors/popup/edit-tier-popup.js
- src/pages/sponsors-global/page-templates/page-template-popup/index.js
- src/pages/sponsors/sponsor-page/tabs/sponsor-cart-tab/components/select-form-dialog/index.js
- src/pages/sponsors/sponsor-page/tabs/sponsor-pages-tab/components/add-sponsor-page-template-popup/index.js
- src/pages/sponsors/sponsor-page/tabs/sponsor-general-form/add-extra-question-popup.js
- src/pages/sponsors/sponsor-form-item-list-page/components/test/inventory-popup.test.js
- src/pages/sponsors/sponsor-page/tabs/sponsor-badge-scans/edit-badge-scan-popup.js
- src/pages/sponsors-global/form-templates/form-template-popup.js
- src/actions/inventory-item-actions.js
Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
ref: https://app.clickup.com/t/9014802374/86bag2zk7
…emove open prop, adjust tests
Summary by CodeRabbit
Release Notes
Bug Fixes
Refactor
Tests