How to judge that the body of an article has been modified?

I am developing a plugin to sync my content to Notion in real time.

My logic is to trigger a change to call the NotionAPI and then add the NotionID property to this article. When you modify it again, by using this NotionID property, call NotionAPIs, delete it and add an new page.
Finally, the latest NotionID will be added into this article again. I set up a hook to trigger changes after article has been modify. the code like :

this.refArr.push( this.app.metadataCache.on('changed',async (file: TFile, data:string,cache: CachedMetadata) => {

But because the property is modified every time after the update, the hook is constantly triggered and becomes a dead loop. I am not in a better position at the moment to find a solution, but to try and find a way out of the.

May view plugin help: View plugins - Developer Documentation (obsidian.md)