Skip to content
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

[i18n] duplicate boolean field is not reactive #7086

Open
razonyang opened this issue Feb 5, 2024 · 8 comments
Open

[i18n] duplicate boolean field is not reactive #7086

razonyang opened this issue Feb 5, 2024 · 8 comments
Labels
area: extensions/widgets/boolean area: i18n type: bug code to address defects in shipped code

Comments

@razonyang
Copy link
Contributor

razonyang commented Feb 5, 2024

Describe the bug

I have a duplicate boolean field comments, when changing it in one locale, the field won't sync in other locales.

The problem is that the boolean widget does not update in real-time, while string and other widgets do. Once you save the page and refresh it, it will switch to the correct value.

To Reproduce
Have a boolean widget with i18n: duplicate, show 2 locales side-by-side, and toggle it. The widget on the other locale will not update.

Expected behavior
The toggle on the second locale should provide feedback in real time as the string widget does.

Screenshots

image

Applicable Versions:

  • Decap CMS version: 3.1.1

CMS configuration

Updated for clarity

local_backend: true
locale: en
media_folder: static/images/uploads
public_folder: /images/uploads
backend:
  name: git-gateway
collections:
- create: true
  folder: content/foo
  i18n: true
  label: Foo
  name: foo
  fields:
  - default: true
    hint: Whether to show comments.
    i18n: duplicate
    label: Comments
    name: comments
    required: false
    widget: boolean
  - i18n: duplicate
    label: Nav Weight
    name: nav_weight
    widget: number

Additional context

@razonyang razonyang added the type: bug code to address defects in shipped code label Feb 5, 2024
@martinjagodic
Copy link
Member

I don't see a comments field in your config, could that be the problem?

@razonyang
Copy link
Contributor Author

Sorry, I cut off the wrong part, updated with full configuration (maybe too long).

@martinjagodic
Copy link
Member

What happens if you remove default and/or required? nav_weight doesn't have them, does it work as expected?

@razonyang
Copy link
Contributor Author

razonyang commented Feb 5, 2024

What happens if you remove default and/or required?

Same issue when 1) remove one of them, 2) remove all of them.

nav_weight doesn't have them, does it work as expected?

Yep, the nav_weight works as expected.

image

@razonyang
Copy link
Contributor Author

The field will be synchronized after clicking the Toggle i18n button twice.

@martinjagodic
Copy link
Member

Could you prepare a minimum reproducible config? This one is very large so it's hard to determine the real culprit

@razonyang
Copy link
Contributor Author

Sure.

backend:
  name: git-gateway
collections:
- create: true
  fields:
  - default: true
    hint: Whether to show comments.
    i18n: duplicate
    label: Comments
    name: comments
    required: false
    widget: boolean
  - i18n: duplicate
    label: Nav Weight
    name: nav_weight
    widget: number
  folder: content/foo
  i18n: true
  label: Foo
  name: foo
i18n:
  default_locale: en
  locales:
  - en
  - zh-hans
  - zh-hant
  structure: multiple_files
local_backend: true
locale: en
logo_url: http://localhost:7070/images/logo.png
media_folder: static/images/uploads
public_folder: /images/uploads
publish_mode: editorial_workflow
search: true
site_url: http://localhost:7070/

decapcms-boolean-i18n-duplicate

@martinjagodic martinjagodic self-assigned this Feb 5, 2024
@martinjagodic martinjagodic changed the title [i18n] duplicate field not sync [i18n] duplicate boolean field is not reactive Feb 5, 2024
@martinjagodic
Copy link
Member

martinjagodic commented Feb 5, 2024

The problem is that the boolean widget does not update in real-time, while string and other widgets do. Once you save the page and refresh it, it will switch to the correct value.

I have other priorities at the moment but I would gladly accept a PR that fixes this.

I updated the original post and title to describe the issue better.

@martinjagodic martinjagodic removed their assignment Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: extensions/widgets/boolean area: i18n type: bug code to address defects in shipped code
Projects
None yet
Development

No branches or pull requests

2 participants