fix: iomodal and folders api calls (#3661)

* Fixed IOModal calling getMessages again

* Fixed folders API being called twice

* removed unused imports

* Re-added query of get messages and changed to enable query when open

* Fix auto login off test
This commit is contained in:
Lucas Oliveira 2024-09-03 14:29:35 -03:00 committed by GitHub
commit 27ad129049
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 26 additions and 21 deletions

View file

@ -1,15 +1,10 @@
import Loading from "@/components/ui/loading";
import {
useDeleteMessages,
useGetMessagesQuery,
useUpdateMessage,
} from "@/controllers/API/queries/messages";
import { useIsFetching } from "@tanstack/react-query";
import {
CellEditRequestEvent,
NewValueParams,
SelectionChangedEvent,
} from "ag-grid-community";
import { NewValueParams, SelectionChangedEvent } from "ag-grid-community";
import cloneDeep from "lodash/cloneDeep";
import { useMemo, useState } from "react";
import TableComponent from "../../../../components/tableComponent";

View file

@ -114,10 +114,13 @@ export default function IOModal({
const messages = useMessagesStore((state) => state.messages);
const flowPool = useFlowStore((state) => state.flowPool);
const { refetch } = useGetMessagesQuery({
mode: "union",
id: currentFlowId,
});
const { refetch } = useGetMessagesQuery(
{
mode: "union",
id: currentFlowId,
},
{ enabled: open },
);
async function sendMessage({
repeat = 1,
@ -158,10 +161,6 @@ export default function IOModal({
setSelectedTab(inputs.length > 0 ? 1 : outputs.length > 0 ? 2 : 0);
}, [allNodes.length]);
useEffect(() => {
refetch();
}, [open]);
useEffect(() => {
const sessions = new Set<string>();
messages

View file

@ -1,6 +1,6 @@
import { useGetFolderQuery } from "@/controllers/API/queries/folders/use-get-folder";
import { useGetFoldersQuery } from "@/controllers/API/queries/folders/use-get-folders";
import { useFolderStore } from "@/stores/foldersStore";
import { useIsFetching } from "@tanstack/react-query";
import { useParams } from "react-router-dom";
import ComponentsComponent from "../componentsComponent";
import HeaderTabsSearchComponent from "./components/headerTabsSearchComponent";
@ -13,10 +13,17 @@ const MyCollectionComponent = ({ type }: MyCollectionComponentProps) => {
const { folderId } = useParams();
const myCollectionId = useFolderStore((state) => state.myCollectionId);
const { data, isLoading } = useGetFolderQuery({
id: folderId ?? myCollectionId ?? "",
const { data, isLoading } = useGetFolderQuery(
{
id: folderId ?? myCollectionId ?? "",
},
{ enabled: !!folderId || !!myCollectionId },
);
const isLoadingFolders = !!useIsFetching({
queryKey: ["useGetFolders"],
exact: false,
});
const { isLoading: isLoadingFolders } = useGetFoldersQuery();
return (
<>

View file

@ -1,5 +1,4 @@
import { expect, test } from "@playwright/test";
import { before, beforeEach } from "node:test";
test("when auto_login is false, admin can CRUD user's and should see just your own flows", async ({
page,
@ -144,7 +143,7 @@ test("when auto_login is false, admin can CRUD user's and should see just your o
await page.getByTestId("icon-ChevronLeft").first().click();
await page.waitForSelector('[id="new-project-btn"]', {
await page.waitForSelector('[data-testid="search-store-input"]:enabled', {
timeout: 30000,
});
@ -214,9 +213,14 @@ test("when auto_login is false, admin can CRUD user's and should see just your o
await page.getByTestId("icon-ChevronLeft").first().click();
await page.waitForSelector('[data-testid="search-store-input"]:enabled', {
timeout: 30000,
});
expect(
await page.getByText(secondRandomFlowName, { exact: true }).isVisible(),
).toBe(true);
expect(
await page.getByText(randomFlowName, { exact: true }).isVisible(),
).toBe(false);
@ -236,7 +240,7 @@ test("when auto_login is false, admin can CRUD user's and should see just your o
timeout: 30000,
});
await page.waitForSelector('[id="new-project-btn"]', {
await page.waitForSelector('[data-testid="search-store-input"]:enabled', {
timeout: 30000,
});