Fix: "Enable Mobile Responsive" toggle resets to on after notification update#124
Open
AmitPaul-akp wants to merge 1 commit into
Open
Fix: "Enable Mobile Responsive" toggle resets to on after notification update#124AmitPaul-akp wants to merge 1 commit into
AmitPaul-akp wants to merge 1 commit into
Conversation
…e (#81297)
The useEffect in WrapperWithLoader fires whenever builderContext.values.type
changes, including the moment an existing notification's saved values populate
the form on edit. It was unconditionally calling
setFieldValue("is_mobile_responsive", nx_type !== "custom"), which silently
overwrote the user's saved toggle (e.g. false) back to true before save, so
updating any existing notification re-enabled mobile responsive every time.
Guard the override behind !builderValues?.nx_id so it only applies when
creating a new notification. For existing entries the user's saved value is
preserved.
Fluent Boards task: https://projects.startise.com/wp-admin/admin.php?page=fluent-boards#/boards/19/tasks/81297-bug-fix-notificationx-mobile-responsive-setting-automatically-re-enables-after-notification-update
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
nxdev/notificationx/components/WrapperWithLoader.tsx: itsuseEffectkeyed onbuilderContext.values.typecallssetFieldValue("is_mobile_responsive", nx_type !== "custom")on every type change — including the initial hydration when an existing notification's savedtypepopulates the form, which overwrites the saved toggle before the user even touches the form.nx_idguard so the override only runs when there is no existing record (i.e. a new notification being created). Existing entries keep whatever the user previously saved.Reproduction (before fix)
Verified locally on NotificationX 3.2.7. Video reproduction: https://d.pr/v/YkVmYO
Fix
nxdev/notificationx/components/WrapperWithLoader.tsxonly. +3 / -1. ThesetFieldValue("is_mobile_responsive", …)call inside the type-change effect is wrapped in annx_idguard so it short-circuits on edit and only runs when creating a new notification.Test plan
customtype → "Enable Mobile Responsive" defaults to on (unchanged behavior).custom→ toggle defaults to off (unchanged behavior).themes_tabstill switches correctly when the type changes.Build artifacts
This PR touches only the webpack source. The compiled
assets/admin/js/admin.jsis intentionally not committed — it should be regenerated by the standard build pipeline before release.Reported by
Client-reported bug via Fluent Boards — #81297 Bug Fix: NotificationX mobile responsive setting automatically re-enables after notification update.