You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Before saving the global, the call to the normalizeValue above returns 1 (as expected)
After saving the block, the call also returns 1
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:
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.
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: