mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-24 01:28:35 +02:00
Fix grpc/ws events error
This commit is contained in:
@@ -62,6 +62,11 @@ export function useGrpcEvents(connectionId: string | null) {
|
|||||||
const events = useAtomValue(grpcEventsAtom);
|
const events = useAtomValue(grpcEventsAtom);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (connectionId == null) {
|
||||||
|
replaceModelsInStore('grpc_event', []);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
invoke<GrpcEvent[]>('plugin:yaak-models|grpc_events', { connectionId }).then((events) => {
|
invoke<GrpcEvent[]>('plugin:yaak-models|grpc_events', { connectionId }).then((events) => {
|
||||||
replaceModelsInStore('grpc_event', events);
|
replaceModelsInStore('grpc_event', events);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
import { invoke } from '@tauri-apps/api/core';
|
import { invoke } from '@tauri-apps/api/core';
|
||||||
import type { WebsocketConnection, WebsocketEvent } from '@yaakapp-internal/models';
|
import type { WebsocketConnection, WebsocketEvent } from '@yaakapp-internal/models';
|
||||||
import { replaceModelsInStore , websocketConnectionsAtom, websocketEventsAtom } from '@yaakapp-internal/models';
|
import {
|
||||||
|
replaceModelsInStore,
|
||||||
|
websocketConnectionsAtom,
|
||||||
|
websocketEventsAtom,
|
||||||
|
} from '@yaakapp-internal/models';
|
||||||
import { atom, useAtomValue } from 'jotai';
|
import { atom, useAtomValue } from 'jotai';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { atomWithKVStorage } from '../lib/atoms/atomWithKVStorage';
|
import { atomWithKVStorage } from '../lib/atoms/atomWithKVStorage';
|
||||||
@@ -45,6 +49,11 @@ export function useWebsocketEvents(connectionId: string | null) {
|
|||||||
const events = useAtomValue(websocketEventsAtom);
|
const events = useAtomValue(websocketEventsAtom);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (connectionId == null) {
|
||||||
|
replaceModelsInStore('websocket_event', []);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
invoke<WebsocketEvent[]>('plugin:yaak-models|websocket_events', { connectionId }).then(
|
invoke<WebsocketEvent[]>('plugin:yaak-models|websocket_events', { connectionId }).then(
|
||||||
(events) => replaceModelsInStore('websocket_event', events),
|
(events) => replaceModelsInStore('websocket_event', events),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user