feat: add add-on types pages, dialog, actions, reducers, tests#999
feat: add add-on types pages, dialog, actions, reducers, tests#999tomrndom wants to merge 2 commits into
Conversation
…yout Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughAdds an Add-On Types CRUD feature to the sponsors inventory section: Redux actions and reducers, a dialog and list page, app routing and menu wiring, translation strings, and Jest coverage for the new flow. ChangesAdd-On Types CRUD Feature
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 6
🤖 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/add-on-types-actions.js`:
- Around line 176-182: The create payload normalization is leaving the
client-side id in place, so new records can be sent with an id of 0. Update
normalizeEntity to also strip id alongside created and last_edited, and ensure
the POST flow that uses normalizeEntity in add-on-types-actions builds create
payloads without any client-generated identifier.
In `@src/components/menu/menu-definition.js`:
- Around line 56-58: The Add-on Types submenu item is missing the accessRoute
restriction, so it can appear for users who only have access to
sponsors_inventory. Update the menuDefinition entry in the add-on types submenu
to include accessRoute set to add-on-types, matching the page’s permission and
the SubMenuItem filtering behavior.
In `@src/pages/sponsors-global/add-on-types/add-on-types-dialog.js`:
- Around line 35-54: AddOnTypesDialog is receiving reducer-backed save errors
from AddOnTypesListPage but never declares or uses an errors prop, so failed
saves are not surfaced in Formik. Update AddOnTypesDialog to accept the errors
prop alongside entity/onSave/onClose, and wire those server-side field errors
into the form state in the formik setup so they display on the matching fields
after a rejected save. Make sure the handling is applied in the AddOnTypesDialog
component and any related submit/error flow that currently swallows onSave
rejections.
In `@src/pages/sponsors-global/add-on-types/add-on-types-list-page.js`:
- Around line 91-94: The add-on type save flow currently waits for the follow-up
reload before resolving, which can keep the dialog open even after a successful
save. Update handleAddOnTypeSave in addOnTypesListPage so it resolves
immediately after saveAddOnType succeeds, and trigger getAddOnTypes(term,
DEFAULT_CURRENT_PAGE, perPage, order, orderDir) separately without blocking the
dialog close; keep the refresh logic associated with the existing save flow so
the list still updates, but do not chain it into the save promise.
- Around line 170-186: The delete confirmation text in MuiTable is missing the
add-on type name because deleteDialogBody receives the resolved display name
from getName, not from the onDelete payload. Update the MuiTable usage in
add-on-types-list-page by passing the appropriate getName prop alongside
deleteDialogBody so the table can resolve the item name before showing the
delete warning.
In `@src/reducers/sponsors_inventory/add-on-types-list-reducer.js`:
- Around line 41-65: The reducer in add-on-types-list-reducer.js is keeping
addOnTypes when currentPage changes, which lets stale rows remain visible after
handleSearch resets the page back to 1. Update the branch in the addOnTypes list
reducer so it also clears addOnTypes when the action is driven by a search term
change, using the existing state update logic around currentPage, order, and
orderDir to distinguish page-only navigation from search/filter resets.
🪄 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: 8ea29459-b89b-4c12-86c8-1f346bbf4ded
📒 Files selected for processing (14)
src/actions/__tests__/add-on-types-actions.test.jssrc/actions/add-on-types-actions.jssrc/components/menu/menu-definition.jssrc/i18n/en.jsonsrc/layouts/add-on-types-layout.jssrc/layouts/primary-layout.jssrc/pages/sponsors-global/add-on-types/__tests__/add-on-types-dialog.test.jssrc/pages/sponsors-global/add-on-types/__tests__/add-on-types-list-page.test.jssrc/pages/sponsors-global/add-on-types/add-on-types-dialog.jssrc/pages/sponsors-global/add-on-types/add-on-types-list-page.jssrc/reducers/__tests__/add-on-types-reducers.test.jssrc/reducers/sponsors_inventory/add-on-type-reducer.jssrc/reducers/sponsors_inventory/add-on-types-list-reducer.jssrc/store.js
Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
ref: https://app.clickup.com/t/9014802374/86bamaxc8
Signed-off-by: Tomás Castillo tcastilloboireau@gmail.com
Summary by CodeRabbit