Skip to content

Commit

Permalink
feat: supports disable checkWhenDBChanged
Browse files Browse the repository at this point in the history
  • Loading branch information
haydenull committed Jun 11, 2022
1 parent 4870c37 commit 85428aa
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
7 changes: 7 additions & 0 deletions src/helper/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,12 @@ export const SETTINGS_SCHEMA: SettingSchemaDesc[] = [
description: 'Select buttons to show',
enumPicker: 'checkbox',
enumChoices: BUTTONS.map(({ title }) => title),
},
{
key: 'checkWhenDBChanged',
title: 'Check Status when DB Changed',
type: 'boolean',
default: true,
description: 'Check status when DB changed, restart logseq to take effect',
}
]
13 changes: 8 additions & 5 deletions src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,14 @@ if (isDevelopment) {
logseq.App.onRouteChanged(async () => {
checkStatus()
})
logseq.DB.onChanged(async () => {
setTimeout(() => {
checkStatus()
}, 1000)
})
if (logseq.settings?.checkWhenDBChanged) {
logseq.DB.onChanged(async () => {
console.log('[faiz:git] === logseq.DB.onChanged')
setTimeout(() => {
checkStatus()
}, 1000)
})
}


})
Expand Down

0 comments on commit 85428aa

Please sign in to comment.