feat: sponsor managed pages delete only for explicits ones#808
feat: sponsor managed pages delete only for explicits ones#808
Conversation
|
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 (5)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughAdds deletion support for sponsor-managed pages (new thunk and action type), includes assigned_type in managed/customized page fetches, gates row delete UI via a new canDelete prop and SPONSOR_MANAGED_PAGE_ASSIGNMENT constant, and wires deletion into SponsorPagesTab with list reload and snackbar feedback. (≈36 words) Changes
Sequence Diagram(s)sequenceDiagram
participant User as User
participant UI as SponsorPagesTab
participant Table as MuiTable
participant Action as deleteSponsorManagedPage (Redux)
participant API as Sponsor Pages API
participant Store as Redux Store
User->>Table: Click Delete button on row
Note over Table,UI: Table renders Delete only if canDelete(row) true (EXPLICIT)
Table->>UI: handleManagedDelete(itemId)
UI->>Action: dispatch(deleteSponsorManagedPage(itemId))
Action->>API: DELETE /sponsor-pages/:pageId
API-->>Action: 200 OK
Action->>Store: dispatch(SPONSOR_MANAGED_PAGE_DELETED)
Store-->>UI: state updated
UI->>Action: dispatch(getSponsorManagedPages())
Action->>API: GET /sponsor-pages (fields include assigned_type, may include filter[], ordering)
API-->>Action: managed pages list
Action->>Store: update pages list
Store-->>UI: re-render table
UI->>User: show success snackbar
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
Comment Tip You can get early access to new features in CodeRabbit.Enable the |
68dcf3c to
9cb4626
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/pages/sponsors/sponsor-pages-tab/index.js (2)
158-171: Move or remove theconsole.logstatement.The
console.logon line 170 executes immediately whenhandleManagedDeleteis called, not after the delete operation completes. If this is for debugging the delete flow, move it inside the.then()block. Otherwise, remove it before merging.♻️ Suggested fix
const handleManagedDelete = (itemId) => { + console.log("DELETE MANAGED ", itemId); // Move here if debugging is needed deleteSponsorManagedPage(itemId).then(() => { const { perPage, order, orderDir } = managedPages; getSponsorManagedPages( term, DEFAULT_CURRENT_PAGE, perPage, order, orderDir, hideArchived ); }); - console.log("DELETE MANAGED ", itemId); };🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/pages/sponsors/sponsor-pages-tab/index.js` around lines 158 - 171, The console.log in handleManagedDelete runs immediately instead of after the deletion completes; either remove it or move it into the deleteSponsorManagedPage(...).then(...) callback so it executes after successful deletion (or log the error in a .catch()). Update the console.log placement relative to deleteSponsorManagedPage and getSponsorManagedPages (both referenced in handleManagedDelete) or delete the console.log entirely before merging.
148-156: Placeholder handlers need implementation before merging.Several handlers are
console.logplaceholders:
handleArchiveCustomizedPage/handleArchiveManagedPagehandleManagedEdit/handleCustomizedEdithandleCustomizedDeleteSince this is WIP, consider adding
TODOcomments or tracking these in the linked ClickUp task to ensure they're addressed before the final merge.Also applies to: 173-179
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/pages/sponsors/sponsor-pages-tab/index.js` around lines 148 - 156, Several handler functions (handleArchiveCustomizedPage, handleArchiveManagedPage, handleManagedEdit, handleCustomizedEdit, handleCustomizedDelete) are only console.log placeholders; replace them with either minimal TODO scaffolding or real implementations: insert a clear TODO comment with the ClickUp task ID and expected behavior, and either call a shared utility (e.g., archiveSponsorPage(item, type)) or throw a descriptive "Not implemented" error so callers fail loudly; ensure signatures remain (item) and wire the same pattern for the handlers at the other occurrence (lines ~173-179) so all placeholder handlers are tracked and not left silently no-oping in production.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/pages/sponsors/sponsor-pages-tab/index.js`:
- Around line 158-171: The console.log in handleManagedDelete runs immediately
instead of after the deletion completes; either remove it or move it into the
deleteSponsorManagedPage(...).then(...) callback so it executes after successful
deletion (or log the error in a .catch()). Update the console.log placement
relative to deleteSponsorManagedPage and getSponsorManagedPages (both referenced
in handleManagedDelete) or delete the console.log entirely before merging.
- Around line 148-156: Several handler functions (handleArchiveCustomizedPage,
handleArchiveManagedPage, handleManagedEdit, handleCustomizedEdit,
handleCustomizedDelete) are only console.log placeholders; replace them with
either minimal TODO scaffolding or real implementations: insert a clear TODO
comment with the ClickUp task ID and expected behavior, and either call a shared
utility (e.g., archiveSponsorPage(item, type)) or throw a descriptive "Not
implemented" error so callers fail loudly; ensure signatures remain (item) and
wire the same pattern for the handlers at the other occurrence (lines ~173-179)
so all placeholder handlers are tracked and not left silently no-oping in
production.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 63a78bc0-36cd-4eb5-9b3e-dff8c252e643
📒 Files selected for processing (4)
src/actions/sponsor-pages-actions.jssrc/components/mui/table/mui-table.jssrc/pages/sponsors/sponsor-pages-tab/index.jssrc/utils/constants.js
|
@tomrndom please rebase against main and fix conflicts |
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>
fe025dd to
b887c85
Compare
ref: https://app.clickup.com/t/86b8nf87e
Signed-off-by: Tomás Castillo tcastilloboireau@gmail.com
Summary by CodeRabbit