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

Data List: Changing list-editor from Single to Multiple requires re-saving #226

Closed
1 task done
eden-jh opened this issue Jun 9, 2022 · 2 comments
Closed
1 task done
Assignees
Labels
bug-report Something isn't working
Milestone

Comments

@eden-jh
Copy link

eden-jh commented Jun 9, 2022

Which Contentment version are you using?

3.3.1

Which Umbraco version are you using? For example: 8.14.1 - don't just write v8

9.5.0

Bug summary

When changing the List editor of a data list from a single-select to a multi-select, the value of the property in the template is null until the content has been re-saved.

Steps to reproduce

  1. Create a Page document type.
  2. Add a "Fruit" property. Create a new configuration for the Contentment Data list with the following settings:
    • Data source: User-defined list (with "Apple", "Raspberry", and "Kiwi" as options, with no icons or labels selected)
    • List editor: Dropdown List
  3. Save your changes
  4. In the Page template, either add code to check/display the value of the fruit property, or add a breakpoint on the view file (anything that will allow you to see the value of Model.Fruit)
  5. Create a Page document in the Content section
  6. Select "Raspberry" in the Fruit property and save your content
  7. Go back to the settings section, and change the List editor of the data type you created in step 2 from Dropdown List to Checkbox List. Save your changes
  8. Rebuild the project so the view will use the updated models
  9. In the content section, open the page you created in step 5. Notice the item you selected in step 6 is still selected in the checkbox
  10. Go to the info tab and click the link to open the page
  11. Notice that Model.Fruit is null

I haven't tested every combination of single selection list editor to multi-select list editor, so I can't say for certain that it happens for all of them, but it definitely happens for more than one. (If I recall correctly, I think I confirmed it with radio buttons to checkboxes and dropdowns to multi-select buttons.)

Expected result / actual result

Expected result:

I'd expect the value of Model.Fruit to be a List containing the single selected option, without having to re-save the content.

Actual result:

The value of Model.Fruit is null in the template. You have to save the content again to get the correct value.

Do you have Umbraco ModelsBuilder enabled?

  • Yes, it is enabled.

What browsers are you seeing the problem on?

No response

@eden-jh eden-jh added the bug-report Something isn't working label Jun 9, 2022
@leekelleher
Copy link
Owner

@eden-jh Thank you for reporting this, and for giving detailed reproduction steps - perfect! 🤩

I can reproduce the bug and working on a fix for the next release.

@leekelleher leekelleher added this to the 3.4.0 milestone Jun 10, 2022
@leekelleher leekelleher changed the title Changing Data List Editor from Single to Multiple Requires Re-saving Data List: Changing list-editor from Single to Multiple requires re-saving Jun 10, 2022
@leekelleher
Copy link
Owner

Fixed in commit 1f9462e. It'll be part of upcoming v3.4.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-report Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants