perf: Load templates on demand, add fetchAllIfNeeded to stores (#13895)

* perf: Load templates on demand and cache fetchAll results

fetchAll on the base store now returns the first result for repeat calls
with the same params, with a force option for callers that need fresh
data. Templates load when the command bar, document header, or block
menu needs them instead of on every page load.

* Make fetchAll caching opt-in via fetchAllIfNeeded

fetchAll always fetches again. fetchAllIfNeeded returns the previous
result for the same params until a model is added to or removed from
the store. Mount-effect callers for reference lists use it.
This commit is contained in:
Tom Moor authored and GitHub committed 2026-09-26 13:41:58 -04:00
1 parent aacc98475d
commit 0e704e6ed2
11 files changed
+67 -17

No files matched your search

+1 -1
View File
@@ -32,7 +32,7 @@ function GitHub() {
const githubAppName = env.GITHUB_APP_NAME;
React.useEffect(() => {
void integrations.fetchAll({
void integrations.fetchAllIfNeeded({
service: IntegrationService.GitHub,
withRelations: true,
});