mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-18 23:43:55 +01:00
Messages are flowing!
This commit is contained in:
@@ -69,6 +69,10 @@ export function GlobalHooks() {
|
||||
? cookieJarsQueryKey(payload)
|
||||
: null;
|
||||
|
||||
const pushToFront = (['http_response', 'grpc_connection'] as Model['model'][]).includes(
|
||||
payload.model,
|
||||
);
|
||||
|
||||
if (queryKey === null) {
|
||||
console.log('Unrecognized created model:', payload);
|
||||
return;
|
||||
@@ -76,7 +80,9 @@ export function GlobalHooks() {
|
||||
|
||||
if (!shouldIgnoreModel(payload)) {
|
||||
// Order newest first
|
||||
queryClient.setQueryData<Model[]>(queryKey, (values) => [payload, ...(values ?? [])]);
|
||||
queryClient.setQueryData<Model[]>(queryKey, (values) =>
|
||||
pushToFront ? [payload, ...(values ?? [])] : [...(values ?? []), payload],
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user