Skip to content

Commit 667824e

Browse files
committed
[FIX] remove meaningless return after page reload in custom fields UI
1 parent fe3d495 commit 667824e

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

spp_custom_fields_ui/CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Changelog
2+
3+
## 2025-11-20
4+
5+
### 2025-11-20 10:12:34 - [FIX] remove meaningless return after page reload in custom fields UI
6+
- Fixed bug where return statement after window.location.reload() was unreachable
7+
- For existing records, reload happens immediately before return, destroying page context
8+
- For new records, setTimeout creates race condition where return value is meaningless
9+
- Added proper handling for result === false case without reload
10+
- Added comments explaining control flow in reload scenarios
11+

spp_custom_fields_ui/static/src/js/custom_fields_ui_reload.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,16 @@ patch(FormController.prototype, {
3131
setTimeout(() => {
3232
window.location.reload();
3333
}, 100);
34+
// Don't return - page will reload soon, making return value meaningless
3435
} else {
3536
// For existing records, reload immediately
37+
// This destroys the page context, so no return is needed
3638
window.location.reload();
3739
}
40+
} else {
41+
// Save returned false, don't reload but propagate the result
42+
return result;
3843
}
39-
40-
return result;
4144
} catch (error) {
4245
// Save failed (validation error, required fields missing, etc.)
4346
// Don't reload, let the user fix the errors

0 commit comments

Comments
 (0)