fix: move newly created agent session to top (#10711)

This commit is contained in:
defi-failure 2025-10-14 20:56:22 +08:00 committed by GitHub
parent 7cf57adceb
commit 004d6d8201
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -21,7 +21,7 @@ export const useSessions = (agentId: string) => {
async (form: CreateSessionForm) => { async (form: CreateSessionForm) => {
try { try {
const result = await client.createSession(agentId, form) const result = await client.createSession(agentId, form)
await mutate((prev) => [...(prev ?? []), result], { revalidate: false }) await mutate((prev) => [result, ...(prev ?? [])], { revalidate: false })
return result return result
} catch (error) { } catch (error) {
window.toast.error(formatErrorMessageWithPrefix(error, t('agent.session.create.error.failed'))) window.toast.error(formatErrorMessageWithPrefix(error, t('agent.session.create.error.failed')))