-
Notifications
You must be signed in to change notification settings - Fork 91
gpnf-limit-entry-min-max-from-field.php
: Fixed an issue with entry min max recalculation logic not working.
#1072
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?
Conversation
… min max recalculation logic not working.
gpnf-limit-entry-min-max-from-field.php]
: Fixed an issue with entry min max recalculation logic not working.gpnf-limit-entry-min-max-from-field.php
: Fixed an issue with entry min max recalculation logic not working.
WalkthroughThis change improves the Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant OutputScript
participant Observable
Caller->>OutputScript: Call output_script()
OutputScript->>Observable: Check for valueHasMutated method
alt valueHasMutated exists
OutputScript->>Observable: Call valueHasMutated() to trigger reactivity
else No valueHasMutated
OutputScript->>Observable: Use entriesRaw to create shallow copy and trigger reactivity
end
Observable-->>OutputScript: Observable updated
OutputScript-->>Caller: Return updated observable state
Possibly related PRs
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🔇 Additional comments (2)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Context
⛑️ Ticket(s): https://secure.helpscout.net/conversation/2900858881/81887
Summary
The snippet to set the min/max of nested form entries is generating errors in the browser console and affecting the Nested Forms field.
https://www.loom.com/share/4f8c17e6082a4b1f9f29ce1f61d296f0?sid=cb9a84fa-2b25-4c62-b6b9-3d76a9377702
This PR updates the logic for triggering Knockout reactivity when the max value field is changed in a GPNestedForms context.
Currently, we have
.valueHasMutated()
on the entries observable to force recalculation when max field value is changed. However, in some scenarios, entries is a computed observable (not writable) and does not support.valueHasMutated()
, leading to a console error. This update adds a fallback by reassigning a shallow clone of entriesRaw() to itself.