Sync shows/disappears

This commit is contained in:
Magnus Åhall 2026-06-09 17:03:01 +02:00
parent 25b763703d
commit 1f24f1f2f2
4 changed files with 67 additions and 44 deletions

View file

@ -115,7 +115,7 @@ export class MarkedPosition {
heading(token) {
const content = this.parser.parseInline(token.tokens)
return `
<div class="heading-container">
<div class="heading-container" data-heading="${token.depth}">
<h${token.depth} ondblclick="setpos(event)" data-offset-start="${token.position.start.offset}" data-offset-end="${token.position.end.offset}">${content}</h${token.depth}>\n
<div class="line"></div>\n
</div>

View file

@ -19,7 +19,6 @@ export class Sync {
let nodeCountDownload = await this.getNodeCount(oldMax)
let nodeCountUpload = await nodeStore.sendQueue.count()
console.log(nodeCountUpload)
_mbus.dispatch('SYNC_DOWNLOAD_COUNT', { count: nodeCountDownload })
_mbus.dispatch('SYNC_UPLOAD_COUNT', { count: nodeCountUpload })
@ -81,11 +80,11 @@ export class Sync {
handled++
if (handled % 100 === 0)
_mbus.dispatch('SYNC_HANDLED', { handled })
_mbus.dispatch('SYNC_DOWNLOADED', { handled })
}
} while (res.Continue)
_mbus.dispatch('SYNC_HANDLED', { handled })
_mbus.dispatch('SYNC_DOWNLOADED', { handled })
nodeStore.setAppState('latest_sync_node', currMax)
} catch (e) {
@ -178,11 +177,12 @@ export class N2SyncProgress extends CustomHTMLElement {
super()
this.reset()
_mbus.subscribe('SYNC_DOWNLOAD_COUNT', event => this.progressHandler(event))
_mbus.subscribe('SYNC_UPLOAD_COUNT', event => this.progressHandler(event))
_mbus.subscribe('SYNC_HANDLED', event => this.progressHandler(event))
_mbus.subscribe('SYNC_DONE', event => this.progressHandler(event))
_mbus.subscribe('SYNC_DOWNLOADED', event => this.progressHandler(event))
_mbus.subscribe('SYNC_UPLOADED', event => this.progressHandler(event))
_mbus.subscribe('SYNC_DONE', event => this.progressHandler(event))
}//}}}
reset() {//{{{
this.state = {
@ -205,11 +205,14 @@ export class N2SyncProgress extends CustomHTMLElement {
this.setSyncState(true)
break
case 'SYNC_HANDLED':
console.log('SYNC_HANDLED', eventData.handled)
case 'SYNC_DOWNLOADED':
this.state.nodesSynced = eventData.handled
break
case 'SYNC_UPLOADED':
this.state.nodesUploaded += eventData.count
break
case 'SYNC_DONE':
// Hides the progress bar.
this.setSyncState(false)
@ -221,10 +224,6 @@ export class N2SyncProgress extends CustomHTMLElement {
// Reload the tree nodes to reflect the new/updated nodes.
window._app.tree.reset()
break
case 'SYNC_UPLOADED':
this.state.nodesUploaded += eventData.count
break
}
this.render()
}//}}}