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:
parent
1c7ef6ee60
commit
27ad129049
4 changed files with 26 additions and 21 deletions
|
|
@ -1,15 +1,10 @@
|
||||||
import Loading from "@/components/ui/loading";
|
import Loading from "@/components/ui/loading";
|
||||||
import {
|
import {
|
||||||
useDeleteMessages,
|
useDeleteMessages,
|
||||||
useGetMessagesQuery,
|
|
||||||
useUpdateMessage,
|
useUpdateMessage,
|
||||||
} from "@/controllers/API/queries/messages";
|
} from "@/controllers/API/queries/messages";
|
||||||
import { useIsFetching } from "@tanstack/react-query";
|
import { useIsFetching } from "@tanstack/react-query";
|
||||||
import {
|
import { NewValueParams, SelectionChangedEvent } from "ag-grid-community";
|
||||||
CellEditRequestEvent,
|
|
||||||
NewValueParams,
|
|
||||||
SelectionChangedEvent,
|
|
||||||
} from "ag-grid-community";
|
|
||||||
import cloneDeep from "lodash/cloneDeep";
|
import cloneDeep from "lodash/cloneDeep";
|
||||||
import { useMemo, useState } from "react";
|
import { useMemo, useState } from "react";
|
||||||
import TableComponent from "../../../../components/tableComponent";
|
import TableComponent from "../../../../components/tableComponent";
|
||||||
|
|
|
||||||
|
|
@ -114,10 +114,13 @@ export default function IOModal({
|
||||||
const messages = useMessagesStore((state) => state.messages);
|
const messages = useMessagesStore((state) => state.messages);
|
||||||
const flowPool = useFlowStore((state) => state.flowPool);
|
const flowPool = useFlowStore((state) => state.flowPool);
|
||||||
|
|
||||||
const { refetch } = useGetMessagesQuery({
|
const { refetch } = useGetMessagesQuery(
|
||||||
mode: "union",
|
{
|
||||||
id: currentFlowId,
|
mode: "union",
|
||||||
});
|
id: currentFlowId,
|
||||||
|
},
|
||||||
|
{ enabled: open },
|
||||||
|
);
|
||||||
|
|
||||||
async function sendMessage({
|
async function sendMessage({
|
||||||
repeat = 1,
|
repeat = 1,
|
||||||
|
|
@ -158,10 +161,6 @@ export default function IOModal({
|
||||||
setSelectedTab(inputs.length > 0 ? 1 : outputs.length > 0 ? 2 : 0);
|
setSelectedTab(inputs.length > 0 ? 1 : outputs.length > 0 ? 2 : 0);
|
||||||
}, [allNodes.length]);
|
}, [allNodes.length]);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
refetch();
|
|
||||||
}, [open]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const sessions = new Set<string>();
|
const sessions = new Set<string>();
|
||||||
messages
|
messages
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { useGetFolderQuery } from "@/controllers/API/queries/folders/use-get-folder";
|
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 { useFolderStore } from "@/stores/foldersStore";
|
||||||
|
import { useIsFetching } from "@tanstack/react-query";
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
import ComponentsComponent from "../componentsComponent";
|
import ComponentsComponent from "../componentsComponent";
|
||||||
import HeaderTabsSearchComponent from "./components/headerTabsSearchComponent";
|
import HeaderTabsSearchComponent from "./components/headerTabsSearchComponent";
|
||||||
|
|
@ -13,10 +13,17 @@ const MyCollectionComponent = ({ type }: MyCollectionComponentProps) => {
|
||||||
const { folderId } = useParams();
|
const { folderId } = useParams();
|
||||||
const myCollectionId = useFolderStore((state) => state.myCollectionId);
|
const myCollectionId = useFolderStore((state) => state.myCollectionId);
|
||||||
|
|
||||||
const { data, isLoading } = useGetFolderQuery({
|
const { data, isLoading } = useGetFolderQuery(
|
||||||
id: folderId ?? myCollectionId ?? "",
|
{
|
||||||
|
id: folderId ?? myCollectionId ?? "",
|
||||||
|
},
|
||||||
|
{ enabled: !!folderId || !!myCollectionId },
|
||||||
|
);
|
||||||
|
|
||||||
|
const isLoadingFolders = !!useIsFetching({
|
||||||
|
queryKey: ["useGetFolders"],
|
||||||
|
exact: false,
|
||||||
});
|
});
|
||||||
const { isLoading: isLoadingFolders } = useGetFoldersQuery();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import { expect, test } from "@playwright/test";
|
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 ({
|
test("when auto_login is false, admin can CRUD user's and should see just your own flows", async ({
|
||||||
page,
|
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.getByTestId("icon-ChevronLeft").first().click();
|
||||||
|
|
||||||
await page.waitForSelector('[id="new-project-btn"]', {
|
await page.waitForSelector('[data-testid="search-store-input"]:enabled', {
|
||||||
timeout: 30000,
|
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.getByTestId("icon-ChevronLeft").first().click();
|
||||||
|
|
||||||
|
await page.waitForSelector('[data-testid="search-store-input"]:enabled', {
|
||||||
|
timeout: 30000,
|
||||||
|
});
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
await page.getByText(secondRandomFlowName, { exact: true }).isVisible(),
|
await page.getByText(secondRandomFlowName, { exact: true }).isVisible(),
|
||||||
).toBe(true);
|
).toBe(true);
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
await page.getByText(randomFlowName, { exact: true }).isVisible(),
|
await page.getByText(randomFlowName, { exact: true }).isVisible(),
|
||||||
).toBe(false);
|
).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,
|
timeout: 30000,
|
||||||
});
|
});
|
||||||
|
|
||||||
await page.waitForSelector('[id="new-project-btn"]', {
|
await page.waitForSelector('[data-testid="search-store-input"]:enabled', {
|
||||||
timeout: 30000,
|
timeout: 30000,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue