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

Deploying new content_type (b) with many_to_many relationship with existing content_type (a) doesn't add empty related property to content_entries already created. #213

Open
greyskin opened this issue Jul 26, 2022 · 0 comments

Comments

@greyskin
Copy link

greyskin commented Jul 26, 2022

Steps to reproduce:

  1. Create content_type_a
  2. Deploy content_type_a via wagon
  3. In the Back Office, create an entry under content_type_a
  4. Create a new content_type_b with many_to_many relationship with content_type_a
  5. Update content_type_a definition to include this relationship
  6. Deploy content_types via wagon
  7. Add the following to a page:
    {% action 'get content_entry' %}
        var contentEntry = findEntry('content_type', 'content-entry-slug');
        setProp('contentEntry', contentEntry);
    {% endaction %}
    
  8. Deploy the page via wagon
  9. Visit the page in a browser
  10. Watch it break. The Back Office error messge will be to the tune of:

Action error - undefined method `content_type_b_ids' for #Locomotive::Steam::ContentEntry:xxx...

Workaround: Create an entry under content_type_b and relate it to the content_type_a entry. I expect this populates the content_type_a entry with the missing content_entry_b property. The relationship can then be removed and the content_entry saved and the above code will not produce the error. (Tested)

I had thought that pulling the content_entries via wagon and then re-deploying would fix the issue but it does not. Interestingly, the content_entries are pulled including the missing content_type_b property in their data, but when reployed, the behaviour of findEntry remains the same. Only the workaround described above seems to change the behaviour.

Should not the deployment of content_type_b update the existing content_type_a entries to include the new content_type_b property?

@greyskin greyskin changed the title Deploying new content_type (b) with many_to_many relationship with existing content_type (a) doesn't update definition of content_entries already created. Deploying new content_type (b) with many_to_many relationship with existing content_type (a) doesn't empty related property to content_entries already created. Jul 26, 2022
@greyskin greyskin changed the title Deploying new content_type (b) with many_to_many relationship with existing content_type (a) doesn't empty related property to content_entries already created. Deploying new content_type (b) with many_to_many relationship with existing content_type (a) doesn't add empty related property to content_entries already created. Jul 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant