obsidian-dataview: Bug report: excessive refreshing
What happened?
the query refreshes too much, when editing a file in another pane.
DQL
No response
JS
let text
let groups = dv.pages('#project')
.where(p => p.date?.toISODate() != time && !p.file.path.includes('templates'))
.sort(p => p.impact)
.sort(p => p.class, 'desc')
.sort(p => p.deadline)
.sort(p => p.file.tasks.completed.includes(false),'desc')
.sort(p => p.date?.toISODate() > time)
.groupBy(p => p.theme)
for (let group of groups.sort(g => g.key, 'desc')) {
if (!group.key) {
dv.header(4, 'ST')
} else {
dv.header(4, group.key)
}
dv.list(group.rows.map(t => {
if (!t.file.tasks.completed.includes(false)) {
text = '☑️ ' + t.file.link
} else if (t.file.tasks.completed.includes(false) && (t.date?.toISODate() <= time) || !t.date) {
text = '⛓ ' + t.file.link
} else if (t.date?.toISODate() > time) {
text = '🗓 ' + t.file.link
} else {
text = t.file.link
}
if (t.deadline !== null) {
text = text + " (" + Math.ceil(t.deadline.diff(DateTime.now()).as('days')) + ")"
}
return text
}))
}
### Dataview Version
0.5.19
### Obsidian Version
0.14.6
### OS
MacOS
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 4
- Comments: 25 (8 by maintainers)
Commits related to this issue
- Add workaround to refresh issue of #1752 Adding a command which can circumvent the issues of #1752, #1759, #2228 (and possibly #1075). This command allows for a full re-run of any query on the active... — committed to holroy/obsidian-dataview by holroy 4 months ago
- Add workaround to refresh issue of #1752 (#2237) * Add workaround to refresh issue of #1752 Adding a command which can circumvent the issues of #1752, #1759, #2228 (and possibly #1075). This comma... — committed to blacksmithgu/obsidian-dataview by holroy 3 months ago
For a simple fix for right now I recommend upping the refresh interval to 2500 or 5000; this doesn’t fix the root problem, but will make it a little less annoying for you.
I’m not quite sure what changed between stable and beta to cause this behavior (the renderer is unchanged), but I think the correct fix is an improvement to the DataviewJS render API to eliminate the annoying refresh behavior in the first place.
Force Refresh
has a bug: https://github.com/blacksmithgu/obsidian-dataview/issues/1752@charleshan I did find a solution to this. I turned off automatic view refreshing, and then I assigned a keyboard shortcut (option-R) to refresh dataview queries. So now, when I open a file that has a query, I just immediately run the shortcut. Ditto if I want to see updated content. That way there isn’t flickering, but it’s super easy to get the results quickly.
How about making it update (flicker) only when there’s a change in the output?
@AB1908 You’re talking to blacksmithgu right ?