-
Notifications
You must be signed in to change notification settings - Fork 4
Feature: sponsor cart form lock & delete #753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,7 +17,8 @@ import { SET_CURRENT_SUMMIT } from "../../actions/summit-actions"; | |
| import { | ||
| REQUEST_SPONSOR_CART, | ||
| RECEIVE_SPONSOR_CART, | ||
| SPONSOR_CART_FORM_DELETED | ||
| SPONSOR_CART_FORM_DELETED, | ||
| SPONSOR_CART_FORM_LOCKED | ||
| } from "../../actions/sponsor-cart-actions"; | ||
|
|
||
| const DEFAULT_STATE = { | ||
|
|
@@ -70,6 +71,24 @@ const sponsorPageCartListReducer = (state = DEFAULT_STATE, action) => { | |
| } | ||
| }; | ||
| } | ||
| case SPONSOR_CART_FORM_LOCKED: { | ||
| const { formId, locked } = payload; | ||
|
|
||
| const forms = state.cart.forms.map((form) => { | ||
| if (form.form_id === formId) { | ||
| return {...form, locked}; | ||
| } | ||
| return form; | ||
| }); | ||
|
|
||
| return { | ||
| ...state, | ||
| cart: { | ||
| ...state.cart, | ||
| forms | ||
| } | ||
| }; | ||
| } | ||
|
Comment on lines
+74
to
+91
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Check how form objects are structured and which ID property is used
rg -n "form\.id|form\.form_id|form_id|is_locked" --type=js -C2 src/Repository: fntechgit/summit-admin Length of output: 5263 🏁 Script executed: #!/bin/bash
# Get the exact code for both cart form cases to confirm the issue
sed -n '62,91p' src/reducers/sponsors/sponsor-page-cart-list-reducer.jsRepository: fntechgit/summit-admin Length of output: 693 Fix critical property name inconsistencies causing UI state mismatch. Two critical issues require correction:
Proposed fix case SPONSOR_CART_FORM_DELETED: {
const { formId } = payload;
- const forms = state.cart.forms.filter((form) => form.id !== formId);
+ const forms = state.cart.forms.filter((form) => form.form_id !== formId);
return {
...state,
cart: {
...state.cart,
forms
}
};
}
case SPONSOR_CART_FORM_LOCKED: {
const { formId, locked } = payload;
const forms = state.cart.forms.map((form) => {
if (form.form_id === formId) {
- return {...form, locked};
+ return {...form, is_locked: locked};
}
return form;
});🤖 Prompt for AI Agents |
||
| default: | ||
| return state; | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing
returnstatement for the promise.lockSponsorCartFormdoes not return the promise, unlikedeleteSponsorCartFormandunlockSponsorCartForm. This prevents callers from chaining or awaiting the operation.Proposed fix
🤖 Prompt for AI Agents