perf: speed up model/agent readiness on the initial draft
Load startup config under the owning project's directory key (resolving from a worktree directory when needed) so the auto-opened draft, which activates the project, finds a ready providers/agents snapshot instead of triggering a second load. Also dedupe app.agents: listAgents now takes the directory directly and shares an in-flight request, so the config store and agents store no longer issue duplicate agent fetches at startup.
This commit is contained in:
@@ -245,8 +245,10 @@ export const useAgentsStore = create<AgentsStore>()(
|
||||
try {
|
||||
const queryParams = configDirectory ? `?directory=${encodeURIComponent(configDirectory)}` : '';
|
||||
|
||||
// Ensure we list agents using the correct project context
|
||||
const agents = await opencodeClient.withDirectory(configDirectory, () => opencodeClient.listAgents());
|
||||
// Ensure we list agents using the correct project context. Pass the
|
||||
// directory directly so this shares the in-flight request with the config
|
||||
// store instead of issuing a duplicate agents fetch at startup.
|
||||
const agents = await opencodeClient.listAgents(configDirectory);
|
||||
|
||||
const agentsWithScope = await Promise.all(
|
||||
agents.map(async (agent) => {
|
||||
|
||||
Reference in New Issue
Block a user