abmp-npm 10.3.11 → 10.3.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/pages/personalDetails.js +19 -3
package/package.json
CHANGED
package/pages/personalDetails.js
CHANGED
|
@@ -998,8 +998,21 @@ async function personalDetailsOnReady({
|
|
|
998
998
|
async function setInterestData() {
|
|
999
999
|
const interestsData = await getInterestAll();
|
|
1000
1000
|
|
|
1001
|
-
_$w('#removeServiceButton').onClick(event => {
|
|
1002
|
-
|
|
1001
|
+
_$w('#removeServiceButton').onClick(async event => {
|
|
1002
|
+
// Capture the stable item id BEFORE awaiting the confirm lightbox.
|
|
1003
|
+
// Reading the chip's text after the await is unsafe: the repeater
|
|
1004
|
+
// recycles its DOM items on re-render, so after a rapid sequence of
|
|
1005
|
+
// deletes event.context can resolve to a recycled node showing a
|
|
1006
|
+
// different service, removing the wrong item (or none). Matching on
|
|
1007
|
+
// the stable _id (as the gallery delete does) avoids that race.
|
|
1008
|
+
const itemId = event.context.itemId;
|
|
1009
|
+
const result = await wixWindow.openLightbox(LIGHTBOX_NAMES.DELETE_CONFIRM);
|
|
1010
|
+
|
|
1011
|
+
if (result && result.toDelete) {
|
|
1012
|
+
selectedServices = selectedServices.filter(service => service._id !== itemId);
|
|
1013
|
+
renderServices();
|
|
1014
|
+
checkFormChanges(FORM_SECTION_HANDLER_MAP.BUSINESS_SERVICES);
|
|
1015
|
+
}
|
|
1003
1016
|
});
|
|
1004
1017
|
|
|
1005
1018
|
if (Array.isArray(interestsData) && interestsData.length > 0) {
|
|
@@ -1077,7 +1090,10 @@ async function personalDetailsOnReady({
|
|
|
1077
1090
|
}
|
|
1078
1091
|
|
|
1079
1092
|
function renderServices() {
|
|
1080
|
-
|
|
1093
|
+
// Pass a fresh array copy so the Wix repeater detects the change and
|
|
1094
|
+
// re-renders. Assigning the same array reference (mutated in place by
|
|
1095
|
+
// add/delete) is treated as a no-op, leaving stale chips on screen.
|
|
1096
|
+
setupRepeater('#servicesRepeater', [...selectedServices]);
|
|
1081
1097
|
}
|
|
1082
1098
|
|
|
1083
1099
|
function setupRepeater(repeaterId, data) {
|