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

Unable to save new content #4698

Open
Pixelguymm opened this issue Aug 23, 2024 · 5 comments
Open

Unable to save new content #4698

Pixelguymm opened this issue Aug 23, 2024 · 5 comments
Labels

Comments

@Pixelguymm
Copy link

To Reproduce

Unsure if it is consistent, but this is what has been causing it for me:

  1. Create a custom component with a relationship field to a page.
  2. Add an instance of that component to a page (the root home page / in my case).
  3. Select that same page as a value for the field on the custom component.
  4. Publish
  5. Try making and publishing a change to a different component on that page.

Expected behavior

The changes get saved after clicking "Publish".

Describe the bug

When clicking "Publish", the changes get reverted. The /api/v1/@apostrophecms/page/ does not include any modified data.
Mind you, not every widget seemed equally affected by this. Rich text widgets in particular stopped saving entirely. It might also have to do with the position of the affected component (before/after) relative to the component that includes the recursive relationship.

My assumption is that the recursivity is what causes the issue. While I'm writing this, I'm remembering that the project property on the relationship would most likely fix this issue by excluding the page's content. Still I think this is worth looking into.

Details

Version of Node.js: v20.16.0

Server Operating System: Windows 11 using WSL. The MongoDB database runs in a docker container.

@Pixelguymm Pixelguymm added the bug label Aug 23, 2024
@boutell
Copy link
Member

boutell commented Aug 23, 2024

By "component" I assume you mean widget.

Please do try project to see if that addresses it for you.

Are you able to create a test project you can share here that demonstrates the issue? Perhaps a fork of apostrophecms/starter-kit-essentials?

@Pixelguymm
Copy link
Author

Pixelguymm commented Aug 23, 2024

By "component" I assume you mean widget.

I do, that's my bad.

It does appear that using project solves the issue.

As for the test project, I'm on the clock right now but I'll see what I can do for you later today.

@boutell
Copy link
Member

boutell commented Aug 23, 2024

Thanks! I agree it would be nice if project wasn't mandatory or if we could at least warn in this situation in a useful way, etc., but it's helpful to know it makes a difference.

@Pixelguymm
Copy link
Author

I was able to recreate the bug, here's the repo: https://github.com/Pixelguymm/apos-bug-report

After setting this up, I am confident that my suspicions were correct. The bug occurs when there's a relationship to the current page in one of the widgets on that page, unless project is used to include only the URL. I also found out that indeed only the widgets placed after the relationship in the hirarchy are affected. The ones before it work without issue.

I included a few pages demonstrating the bug, they're in the json files I exported from MongoDB. Mind that any time I mention editing a widget, I mean editing it and publishing the changes without them getting lost.

All details regarding OS and node version are the same as the original report.

@BoDonkey
Copy link
Contributor

Thanks for the very thorough bug report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants