Coalesce the redundant GET /api/documents requests fired on load.…#401
Merged
Conversation
…(#2280) PageListContext, EmptyEditorState, and the wiki-link suggestion source each independently fetch the full /api/documents listing; on boot and every CC1 files push they ran the same ready-gated disk walk two or three times concurrently. Route them through a shared single-flight coordinator so overlapping calls coalesce into one request plus one parse. Single-flight, not a cache: the slot releases on settle, so consumers that refetch on a files push still get current data. FileTree's depth=1 lazy fetch (a different URL) is unchanged. GitOrigin-RevId: e6ac46966acca08cf896e3263d9b7bffdd2043d5
Contributor
There was a problem hiding this comment.
Automated approval from agents-private public-mirror-sync (run: https://github.com/inkeep/agents-private/actions/runs/28477098978). Source of truth is the monorepo; direct edits on inkeep/open-knowledge are overwritten on next sync.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Coalesce the redundant
GET /api/documentsrequests fired on load. Several consumers independently fetch the same full listing — the page-list context (asset/folder/file paths), the empty-editor state (entry count for the onboarding branch), and the wiki-link suggestion source (referenced assets) — so on boot and on every file-change push the server ran the sameready-gated disk walk two or three times concurrently. These now share a single in-flight request and one JSON parse. It is single-flight, not a result cache: the slot is released as soon as the request settles, so consumers that refetch on a file-change push still get current data. The sidebar file tree keeps its owndepth=1lazy fetch (a different URL) unchanged.