Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(viewer): report loaded again when Viewer resets the flag
Viewer creates a new file object when the same file is opened again,
which happens when a version comparison starts, and the new object
starts with loaded set to false. The component is kept because its key
is unchanged, so nothing reported loaded again and the loading spinner
stayed on top of the comparison. Watch the flag passed by Viewer and
report loaded once more when it drops after the content has loaded.

Signed-off-by: Jonas <jonas@freesources.org>
Assisted-by: ClaudeCode:claude-opus-5.5
  • Loading branch information
mejo- committed Sep 29, 2026
commit b8d93b5d7db1f4213ae1cc550152a12820f73292
22 changes: 21 additions & 1 deletion src/views/ViewerView.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,31 @@ export default defineComponent({
render: (h) => h('div', { style: { display: 'contents' } }),
props: ViewerComponent.props,
inheritAttrs: false,
data() {
return {
hasLoaded: false,
}
},

watch: {
// Viewer creates a new file object when the same file is opened again,
// e.g. for a version comparison, and resets its loaded flag while its
// component is kept. Report loaded again in that case.
'$attrs.loaded': function(loaded) {
if (!loaded && this.hasLoaded) {
this.$emit('update:loaded', true)
}
},
},

mounted() {
innerApp = createApp(ViewerComponent, {
...this.$props,
...this.$attrs,
onLoadedHandler: () => this.$emit('update:loaded', true),
onLoadedHandler: () => {
this.hasLoaded = true
this.$emit('update:loaded', true)
},
})
innerApp.mount(this.$el)
},
Expand Down