Skip to content

Refactor: optimize notes covers rendering#356

Open
7eliassen wants to merge 3 commits into
mainfrom
refactor/note-list-loading
Open

Refactor: optimize notes covers rendering#356
7eliassen wants to merge 3 commits into
mainfrom
refactor/note-list-loading

Conversation

@7eliassen

Copy link
Copy Markdown
Contributor

Refactor: optimize notes covers rendering

Problem

The homepage currently suffers from poor loading performance. The note list is not displayed until all cover images have finished downloading, causing significant delays — especially on slower connections.

Solution

  • Parallelized cover requests — switched to asynchronous requests for downloading covers, allowing multiple connections to be established simultaneously for faster overall load time.
  • Decoupled cover loading from metadata fetching — note metadata now loads first, while covers are fetched independently in the background.
  • Reactive cover rendering — covers appear on cards progressively as soon as each individual image finishes downloading, rather than waiting for the entire batch to complete.

Preview

Peek 2026-07-08 13-125

Implementation Details

noteList.service.ts

  • getNoteList() now returns metadata only (cover downloads are excluded)
  • Added new loadCover() method for per-note asynchronous cover fetching

useNoteList.ts

  • Introduced loadCovers() which downloads all covers in parallel using Promise.all() and updates each note reactively upon completion
  • loadNextPage() triggers loadCovers() in the background after the list is rendered, ensuring a smooth user experience

Performance Improvements

Tested on Linux in Firefox and Chrome

Home page loading (30 notes with covers):

Browser Before After
Firefox ~20s ~5s
Chrome ~12s ~4s

@vercel

vercel Bot commented Jul 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
codex-ui Ready Ready Preview, Comment Jul 8, 2026 2:30pm

@neSpecc neSpecc requested a review from Copilot July 8, 2026 16:04

@neSpecc neSpecc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we show cover skeleton while image is still loading?

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors homepage note cover loading to improve perceived performance by fetching note metadata first and then downloading cover images asynchronously, allowing covers to render progressively as they arrive.

Changes:

  • Refactors NoteListService.getNoteList() to return metadata only and introduces loadCover() for per-note cover fetching.
  • Adds background parallel cover downloading in useNoteList and updates notes reactively as covers complete.
  • Updates NoteList.vue to only pass blob URLs to the Card image source.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/presentation/components/note-list/NoteList.vue Only renders a cover when it’s a blob: URL (progressive rendering support).
src/domain/noteList.service.ts Splits cover downloading into a dedicated loadCover() method and returns metadata-only lists.
src/application/services/useNoteList.ts Adds background parallel cover loading and reactive per-item updates; updates lifecycle cleanup implications.
Comments suppressed due to low confidence (1)

src/application/services/useNoteList.ts:155

  • cover now holds a server key until it’s replaced with a blob: URL. The unmount cleanup currently calls URL.revokeObjectURL for any non-null cover, which will include non-blob keys. Restrict revocation to actual blob: URLs so the cleanup only targets object URLs created by URL.createObjectURL.
    loadCovers().catch(console.error);
  };

  /**
   * Load first notes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 75 to 83
@@ -82,6 +82,47 @@ export default function (onlyCreatedByUser = false): UseNoteListComposableState
return list;
};
Comment on lines +112 to +122
const url = await noteListService.loadCover(item.id, item.cover);

if (url !== null) {
/**
* Update the specific note's cover reactively so the card renders the image
*/
list.items[index] = {
...item,
cover: url,
};
}
@7eliassen 7eliassen changed the title Refactor: Refactor: optimize notes covers rendering Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants