Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: iomodal and folders api calls #3661

Merged
merged 5 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
15 changes: 7 additions & 8 deletions src/frontend/src/modals/IOModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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 (
<>
Expand Down
10 changes: 7 additions & 3 deletions src/frontend/tests/end-to-end/auto-login-off.spec.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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,
});

Expand Down Expand Up @@ -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);
Expand All @@ -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,
});

Expand Down
Loading