Target view in config fails on reinstall as view UUIDs change

Created on 11 December 2020, about 4 years ago
Updated 18 December 2024, 4 days ago

This is a reincarnation of #2906015: Does not import properly using Features , which we aren't able to reopen. It's not a Features-specific issue; it's actually more general. From #2906015-5: Does not import properly using Features :

I'm fairly certain I'm seeing a version of this, although I'm not using Features per se. When I export viewfield config, it contains a target_id referencing the uuid of the view as it exists in the current install. If I subsequently reinstall my site using this exported config, the view gets assigned a different uuid, and therefore the viewfield configuration breaks.

In my context, we're building an install profile to create a site using a content type with a viewfield, so we need this to work. What would be involved in transitioning the target_id to (optionally, perhaps?) store the machine name of the view, rather than a uuid (which is apparently not universal, in this case)?

I don't see a problem with using the view machine name here so I'm in favour of that approach. It's always been the ID within the site, and it'll persist across reinstallations, even when all of the IDs/UUIDs change.

🐛 Bug report
Status

RTBC

Version

3.0

Component

Code

Created by

🇨🇦Canada colan Toronto 🇨🇦

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇩🇪Germany rnsrk

    Hi, I tested the fix:

    1. Created View, gave it custom machine name.
    2. Created Viewfield, set "Always use default value" and "Set default value" to the view above.
    3. Export configs for field storage and field.
    4. Delete Viewfield.
    5. Clear cache.
    6. Import configs for field storage and field.
    7. All settings are there, Viewfield is displayed! 👍

    Please merge!

Production build 0.71.5 2024