Skip to content

Commit

Permalink
Make onMutate compare objects deeply when deciding to trigger the c…
Browse files Browse the repository at this point in the history
…allback

Signed-off-by: William So <[email protected]>
  • Loading branch information
polyipseity committed Sep 30, 2023
1 parent 88b03ba commit 33bf954
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/mighty-hairs-cover.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@polyipseity/obsidian-plugin-library": minor
---

Make `onMutate` compare objects deeply when deciding to trigger the callback.
4 changes: 2 additions & 2 deletions sources/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ export abstract class AbstractSettingsManager<T extends AbstractSettingsManager
const settings = this.value,
cur = accessor(settings),
prev0 = prev
if (prev0 !== cur) {
prev = cur
prev = cur
if (!deepEqual(cur, prev0, { strict: true })) {
await callback(cur, prev0, settings)
}
})
Expand Down

0 comments on commit 33bf954

Please sign in to comment.