-
Notifications
You must be signed in to change notification settings - Fork 66
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
Potential issue with neo blocks within globals #982
Comments
I was able to get the Neo block to delete by changing the line to: $this->field->normalizeValue(clone $this->rawValue)->anyStatus()->all() I'm not sure if there would be a better place in your code to do it, so I'm not going to open a pull request to make the above change, but basically the original Neo block query needs to be cloned before using it. |
Ha, cloning the query... why didn't I think about it. That fixes the issue of blocks not saved properly, thanks ! The query after save still returns 1 in the scenario above though, and only for globals. |
Just to make sure I'm understanding correctly - after the one block on the global set is deleted, the query above is still returning that block? |
@ttempleton Yes that's correct |
Hi @ttempleton any luck with this one ? |
What question would you like to ask?
Hi,
I'm the maintainer of the plugin activity which integrates with Neo to calculate field changes when an element is saved.
I'm chasing a bug where the activity plugin would somehow disrupt Neo blocks saving when the Neo field is inside a global. The activity plugin calculates the field value before a global is saved and after, and calculate changes from that.
The blocks for a field are fetched with
$this->field->normalizeValue($this->rawValue)->anyStatus()->all()
where$this->rawValue
is a Neo block query and$this->field
the Neo field.Say I have a global with a Neo field that has one block, and I remove it.
normalizeValue
above returns 1 (as expected)If I do the same on an entry, the call to the
normalizeValue
above after saving returns 0 (as expected), so this is specific to globals it seems.And another issue : the blocks aren't saved at all. when the page is reloaded the block I deleted is still there.
If I remove the call to the
normalizeValue
above, the block is deleted as expected.This is on Craft 4.13.7 with Neo version 4.2.23.
It may be an issue on my side, but the fact that it works for entries (with the exact same code) makes me think that there may be a different behavior in Neo regarding globals ? maybe someething related to memoized queries ?
Do you see any issues in the way I fetch the blocks in the query above ?
Any other pointers appreciated
Thanks for your time
The text was updated successfully, but these errors were encountered: