mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-20 08:33:52 +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],
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { useMutation, useQuery } from '@tanstack/react-query';
|
||||
import { invoke } from '@tauri-apps/api';
|
||||
import type { UnlistenFn } from '@tauri-apps/api/event';
|
||||
import { emit, listen } from '@tauri-apps/api/event';
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import { emit } from '@tauri-apps/api/event';
|
||||
import { useEffect, useState } from 'react';
|
||||
import type { GrpcConnection, GrpcMessage, GrpcRequest } from '../lib/models';
|
||||
import { useKeyValue } from './useKeyValue';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user