[SOLVED] Fallbacks failing for empty strings after editing

I have…

  • [ ] Checked the logs and have uploaded a log file and provided a link because I found something suspicious there. Please do not post the log file in the topic because very often something important is missing.

I’m submitting a…

  • [ ] Regression (a behavior that stopped working in a new release)
  • [ x ] Bug report
  • [ ] Performance issue
  • [ ] Documentation issue or request

Current behavior

Fallbacks seem to fail after populating and then later deleting the contents of a field.

Expected behavior

Field should fallback if empty.

Minimal reproduction of the problem

  • Have languages en and sv, where sv is optional and fallbacks to en.
  • Populate a text field, eg. heroHeading, for both languages. Save.
  • Remove the text in heroHeading for sv. Save.

The api response for heroHeading is an empty string "" instead of the value of en.

Reproduced with a regular string input and an input with the CKE editor. In the case of the CKE editor, the value was <p>&nbsp;</p>

Environment

  • [ x ] Self hosted with docker
  • [ ] Self hosted with IIS
  • [ ] Self hosted with other version
  • [ ] Cloud version

Version: [VERSION]

Browser:

  • [ x ] Chrome (desktop)
  • [ ] Chrome (Android)
  • [ ] Chrome (iOS)
  • [ ] Firefox
  • [ ] Safari (desktop)
  • [ ] Safari (iOS)
  • [ ] IE
  • [ ] Edge

The question is: How to distinguish between an empty string that is there on purpose and a empty string because the content has been unset?

Perhaps the solution would be to add a clear button somewhere to the UI?

Mm, I see your point there. In my opinion, I would see empty strings falling back as a behavior that is more expected. Especially since there isn’t a way of seeing in the ui whether an empty field will/won’t fall back (for the moment, at least). I’d also imagine the use cases for wanting an empty string are fairly sparse.

A clear button sounds like a great solution :+1: Perhaps only show it if the field is actually populated so there is a way detecting whether it’s an empty string or not?

1 Like

Lets say you have a ad banner for a website and you don’t want to show the banner for a language or the banner is not ready yet. Then it would show the fallback version instead, in another language.

1 Like

Hi, I have solved it in the master branch by always converting empty string to undefined in the UI

Awesome, thank you! Honestly haven’t had the chance to check out the change yet, but it sounds promising :heart:

1 Like