OverviewFilesCommitsIssuesDocsReleasesPeers

hyper-note commits / a4b8718

Add P2P sync loading indicators for slow note loads
After 3 seconds of loading, show "Syncing notes from P2P network" message on home feed, notebook view, and individual note view. Informs user that multiwriter sync is in progress rather than showing a dead "Loading..." that looks broken. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
a4b87183e6637dc3e8140e9e458176011d2fbb91
by plankatron <fleeky@gmail.com> · 2026-03-20T01:27:28.000Z

Changed files (1) +22 -1

web/js/app.js +22 -1
……@@ -682,10 +682,15 @@
682682
683683 async function loadRecentFeed () {
684684 var container = $viewHome
685 container.innerHTML = '<h1>Recent Notes</h1><p class="text-muted">Loading...</p>'
685 container.innerHTML = '<h1>Recent Notes</h1><p class="text-muted" id="home-loading">Loading...</p>'
686 var loadingEl = document.getElementById('home-loading')
687 var loadTimer = setTimeout(function () {
688 if (loadingEl) loadingEl.textContent = 'Syncing notes from P2P network, this may take a moment...'
689 }, 3000)
686690
687691 try {
688692 var data = await HnApi.recentNotes(20)
693 clearTimeout(loadTimer)
689694 var notes = data.notes || []
690695
691696 if (notes.length === 0) {
……@@ -790,7 +795,13 @@
790795 } catch (e) { /* multi-writer not available, skip */ }
791796 }
792797
798 $notebookNotes.innerHTML = '<p class="text-muted" id="nb-loading">Loading notes...</p>'
799 var nbLoadTimer = setTimeout(function () {
800 var el = document.getElementById('nb-loading')
801 if (el) el.textContent = 'Syncing notes from P2P network, this may take a moment...'
802 }, 3000)
793803 await loadNoteList(slug)
804 clearTimeout(nbLoadTimer)
794805 renderNotebookCards(slug)
795806
796807 // Handle wiki-link redirect
……@@ -917,6 +928,15 @@
917928
918929 async function loadNote (notebook, noteId) {
919930 try {
931 // Show loading state immediately
932 showView('note')
933 $noteContent.className = 'markdown-body'
934 $noteContent.innerHTML = '<p class="text-muted" id="note-loading">Loading...</p>'
935 var noteLoadTimer = setTimeout(function () {
936 var el = document.getElementById('note-loading')
937 if (el) el.textContent = 'Syncing note from P2P network, this may take a moment...'
938 }, 3000)
939
920940 // Load notebook context if needed
921941 if (!state.currentNotebook || state.currentNotebook.slug !== notebook) {
922942 var nbData = await HnApi.getNotebook(notebook)
……@@ -925,6 +945,7 @@
925945 }
926946
927947 var data = await HnApi.getNote(notebook, noteId)
948 clearTimeout(noteLoadTimer)
928949 state.currentNote = data.note || data
929950 showView('note')
930951 updateBreadcrumb()