mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-11-07 19:20:34 +00:00
A background-task detail or list read issued before the user cancels can resolve after the mutation's success handler and overwrite the confirmed "cancelled" snapshot with the pre-cancel "working" one, so the expanded card shows the task as active again (and polling resumes) until a later response corrects it. useCancelBackgroundTask now awaits cancelQueries for the thread's ["background-tasks", threadId] prefix before seeding the confirmed detail and list entry, so a read that started before the cancel is dropped instead of landing afterwards. The following list invalidation is unchanged, so a mounted card still refreshes from the server. This is the same ordering contract as the memory mutations fixed in #6959. Regression: frontend/tests/unit/core/background-tasks/hooks.dom.test.tsx uses a real QueryClient with deferred detail and list reads; it ends on "working" without the fix and keeps "cancelled" with it. Co-authored-by: REI-330 <173389910+REI-330@users.noreply.github.com> Co-authored-by: AochenShen99 <sac1063467113@hotmail.com>