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
The content.save event is triggered in a block fields preview although content hasn’t changed, see video below.
Expected behavior
If possible, only trigger the event when there are actual content changes.
(We are trying to use this event reload the preview page automatically, i.e. extending our reload on save plugin.)
@distantnative I've an idea about the solution. Compare the changes for each update event and only trigger the save event when blocks have any changes. Roughly something like following. What do you think?
update(block,content){constindex=this.findIndex(block.id);if(index===-1)return;consttargetBlock=this.blocks[index].content;// compare the content changesconsthasChanges=Object.entries(content).some(([key,value])=>{if(targetBlock[key]!==value){set(targetBlock,key,value);returntrue;}returnfalse;});// only trigger save event when has changesif(hasChanges){this.save();}}
Description
The
content.save
event is triggered in a blockfields
preview although content hasn’t changed, see video below.Expected behavior
If possible, only trigger the event when there are actual content changes.
(We are trying to use this event reload the preview page automatically, i.e. extending our reload on save plugin.)
Video
https://github.com/user-attachments/assets/e205bdf6-3e79-444d-b598-eeb17c10fa5a
To reproduce
Your setup
Kirby Version
5.0.0 beta 2
Your system
Chrome 132, Safari 18.3, Firefox 134 on macOS 15.3
The text was updated successfully, but these errors were encountered: