winter
winter copied to clipboard
dependsOn triggers infinite loop
Winter CMS Build
1.1
PHP Version
7.4
Database engine
MySQL/MariaDB
Plugins installed
No response
Issue description
When a model has two fields that are dependent upon one another, an infinite loop occurs when the dependants are refreshed (line ~189 of winter.form.js: $('[data-field-name="' + toRefresh.fields[0] + '"]').trigger('change')
Appears to be related to this update: https://github.com/wintercms/winter/commit/712843d3c231432cefcc3fd5728518e43f73cd33#diff-cf4c08be53eb135693cb4e0424261e5d15c7475d92abc4c87aff32cb81266413
Steps to replicate
Model setup:
alpha_field_one:
type: switch
dependsOn:
- alpha_field_two
alpha_field_two:
type: switch
dependsOn:
- alpha_field_one
Workaround
No response
Why do you have a circular dependency in the first place?
In my use case I would like both fields to be available at the outset (fresh page load/create), but if one switch is enabled, then the other option should be hidden (or disabled)
Also worth noting that I have to use dependsOn
and can’t use trigger
as there are other fields that are impacted by these two switches
@Mrkbingham why don't you use a single balloon-selector
field instead to toggle between the two states?
@LukeTowers each field has a complex knock-on effect depending upon selection, so I need a desc explaining each option. I think the radio selector might be my since it supports the secondary description.
It'd be great to get something like a console.error() on a circular logic loop in winter.form.js
This issue will be closed and archived in 3 days, as there has been no activity in the last 60 days. If this issue is still relevant or you would like to see it actioned, please respond and we will re-open this issue. If this issue is critical to your business, consider joining the Premium Support Program where a Service Level Agreement is offered.
This issue will be closed and archived in 3 days, as there has been no activity in this issue for the last 6 months. If this issue is still relevant or you would like to see it actioned, please respond within 3 days. If this issue is critical for your business, please reach out to us at [email protected].
This issue will be closed and archived in 3 days, as there has been no activity in this issue for the last 6 months. If this issue is still relevant or you would like to see it actioned, please respond within 3 days. If this issue is critical for your business, please reach out to us at [email protected].
This issue will be closed and archived in 3 days, as there has been no activity in this issue for the last 6 months. If this issue is still relevant or you would like to see it actioned, please respond within 3 days. If this issue is critical for your business, please reach out to us at [email protected].
This issue will be closed and archived in 3 days, as there has been no activity in this issue for the last 6 months. If this issue is still relevant or you would like to see it actioned, please respond within 3 days. If this issue is critical for your business, please reach out to us at [email protected].