-
Notifications
You must be signed in to change notification settings - Fork 145
feat: Add server-side search and pagination performance improvements #1668
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
cbcoutinho
wants to merge
11
commits into
nextcloud:main
Choose a base branch
from
cbcoutinho:fix/notes-ui-performance-exclude-content
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+490
−89
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
46f1d56
perf: optimize initial notes loading by excluding content
cbcoutinho b4c4ad2
perf: implement incremental pagination for notes list scrolling
cbcoutinho 4a8abb1
perf: fix rapid-fire pagination causing all notes to load
cbcoutinho 940324b
perf: implement chunked API loading to prevent fetching all notes on …
cbcoutinho 452333f
debug: add comprehensive console logging to investigate pagination hang
cbcoutinho e3d1981
fix: Return full note metadata for pruned notes in paginated API
cbcoutinho b1ef0b7
fix: Prevent periodic refresh from overwriting search results
cbcoutinho e5c119a
feat: Add server-side search with pagination support
cbcoutinho d828b9f
Merge branch 'main' into fix/notes-ui-performance-exclude-content
cbcoutinho 59a4bb2
Merge branch 'main' into fix/notes-ui-performance-exclude-content
cbcoutinho a45b761
Merge branch 'main' into fix/notes-ui-performance-exclude-content
cbcoutinho File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -128,33 +128,53 @@ export default { | |
| }, | ||
|
|
||
| methods: { | ||
| loadNotes() { | ||
| fetchNotes() | ||
| .then(data => { | ||
| if (data === null) { | ||
| // nothing changed | ||
| return | ||
| } | ||
| if (data.notes !== null) { | ||
| this.error = false | ||
| this.routeDefault(data.lastViewedNote) | ||
| } else if (this.loading.notes) { | ||
| // only show error state if not loading in background | ||
| this.error = data.errorMessage | ||
| } else { | ||
| console.error('Server error while updating list of notes: ' + data.errorMessage) | ||
| } | ||
| }) | ||
| .catch(() => { | ||
| async loadNotes() { | ||
| console.log('[App.loadNotes] Starting initial load') | ||
| // Skip refresh if in search mode - search results should not be overwritten | ||
| const searchText = store.state.app.searchText | ||
| if (searchText && searchText.trim() !== '') { | ||
| console.log('[App.loadNotes] Skipping - in search mode with query:', searchText) | ||
| this.startRefreshTimer(config.interval.notes.refresh) | ||
| return | ||
| } | ||
|
Comment on lines
+137
to
+139
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great point, this was an oversight - I will try to bring those subheaders back |
||
| try { | ||
| // Load only the first chunk on initial load (50 notes) | ||
| // Subsequent chunks will be loaded on-demand when scrolling | ||
| const data = await fetchNotes(50, null) | ||
| console.log('[App.loadNotes] fetchNotes returned:', data) | ||
|
|
||
| if (data === null) { | ||
| // nothing changed (304 response) | ||
| console.log('[App.loadNotes] 304 Not Modified - no changes') | ||
| return | ||
| } | ||
|
|
||
| if (data && data.noteIds) { | ||
| console.log('[App.loadNotes] Success - received', data.noteIds.length, 'note IDs') | ||
| console.log('[App.loadNotes] Next cursor:', data.chunkCursor) | ||
| this.error = false | ||
| // Route to default note after first chunk | ||
| this.routeDefault(0) | ||
|
|
||
| // Store cursor for next chunk (will be used by scroll handler) | ||
| store.commit('setNotesChunkCursor', data.chunkCursor || null) | ||
| } else if (this.loading.notes) { | ||
| // only show error state if not loading in background | ||
| if (this.loading.notes) { | ||
| this.error = true | ||
| } | ||
| }) | ||
| .then(() => { | ||
| this.loading.notes = false | ||
| this.startRefreshTimer(config.interval.notes.refresh) | ||
| }) | ||
| console.log('[App.loadNotes] Error - no noteIds in response') | ||
| this.error = data?.errorMessage || true | ||
| } else { | ||
| console.error('Server error while updating list of notes: ' + (data?.errorMessage || 'Unknown error')) | ||
| } | ||
| } catch (err) { | ||
| // only show error state if not loading in background | ||
| if (this.loading.notes) { | ||
| this.error = true | ||
| } | ||
| console.error('[App.loadNotes] Exception:', err) | ||
| } finally { | ||
| this.loading.notes = false | ||
| this.startRefreshTimer(config.interval.notes.refresh) | ||
| } | ||
| }, | ||
|
|
||
| startRefreshTimer(seconds) { | ||
|
|
@@ -192,7 +212,17 @@ export default { | |
| }, | ||
|
|
||
| routeDefault(defaultNoteId) { | ||
| if (this.$route.name !== 'note' || !noteExists(this.$route.params.noteId)) { | ||
| console.log('[App.routeDefault] Called with defaultNoteId:', defaultNoteId) | ||
| console.log('[App.routeDefault] Current route:', this.$route.name, 'noteId:', this.$route.params.noteId) | ||
| // Don't redirect if user is already on a specific note route | ||
| // (the note will be fetched individually even if not in the loaded chunk) | ||
| if (this.$route.name === 'note' && this.$route.params.noteId) { | ||
| console.log('[App.routeDefault] Already on note route, skipping redirect') | ||
| return | ||
| } | ||
| // Only redirect if no note route is set (e.g., on welcome page) | ||
| if (this.$route.name !== 'note') { | ||
| console.log('[App.routeDefault] Not on note route, routing to default') | ||
| if (noteExists(defaultNoteId)) { | ||
| this.routeToNote(defaultNoteId) | ||
| } else { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the search text is cleared, we should see the list of all notes. Currently, when that happens, it's empty