Skip to content

Commit

Permalink
[OPIK-319]: fix the eslint issues;
Browse files Browse the repository at this point in the history
  • Loading branch information
Sasha committed Nov 6, 2024
1 parent d5c367b commit d6239d1
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const CommitsTab = ({ prompt }: CommitsTabInterface) => {
});
}
},
[prompt?.id],
[prompt?.id, navigate, workspaceName],
);

if (isPending) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const EditPromptDialog: React.FunctionComponent<EditPromptDialogProps> = ({

return (
<Dialog open={open} onOpenChange={setOpen}>
<DialogContent className="smax-w-lg sm:max-w-[720px]">
<DialogContent className="max-w-lg sm:max-w-[720px]">
<DialogHeader>
<DialogTitle>Edit prompt</DialogTitle>
</DialogHeader>
Expand All @@ -56,7 +56,7 @@ const EditPromptDialog: React.FunctionComponent<EditPromptDialogProps> = ({
can access older versions of the prompt from the <b>Commits</b> tab.
</p>

<div className="pt-4 pb-4">
<div className="py-4">
<Label htmlFor="promptTemplate">Prompt</Label>
<Textarea
className="comet-code h-[400px]"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ const PromptTab = ({ prompt }: PromptTabInterface) => {
if (prompt?.latest_version?.id && !activeVersionId) {
setActiveVersionId(prompt.latest_version.id);
}
}, [prompt?.latest_version?.id, activeVersionId]);
}, [prompt?.latest_version?.id, activeVersionId, setActiveVersionId]);

useEffect(() => {
return () => {
setActiveVersionId(null);
};
}, []);
}, [setActiveVersionId]);

if (!prompt) {
return <Loader />;
Expand All @@ -87,10 +87,10 @@ const PromptTab = ({ prompt }: PromptTabInterface) => {
</Button>
</div>

<div className="flex items-stretch rounded-md border bg-white px-6 pb-6 pt-6 mt-6 gap-2">
<div className="flex flex-col flex-grow">
<div className="flex items-stretch rounded-md border bg-white p-6 mt-6 gap-2">

Check warning on line 90 in apps/opik-frontend/src/components/pages/PromptPage/PromptTab/PromptTab.tsx

View workflow job for this annotation

GitHub Actions / lint

Invalid Tailwind CSS classnames order
<div className="flex flex-col grow">

Check warning on line 91 in apps/opik-frontend/src/components/pages/PromptPage/PromptTab/PromptTab.tsx

View workflow job for this annotation

GitHub Actions / lint

Invalid Tailwind CSS classnames order
<p className="comet-body-s-accented text-foreground">Prompt</p>
<code className="comet-code w-full break-words whitespace-pre-wrap rounded-md bg-[#FBFCFD] p-3 flex mt-2 h-full">
<code className="comet-code size-full break-words whitespace-pre-wrap rounded-md bg-[#FBFCFD] p-3 flex mt-2">

Check warning on line 93 in apps/opik-frontend/src/components/pages/PromptPage/PromptTab/PromptTab.tsx

View workflow job for this annotation

GitHub Actions / lint

Invalid Tailwind CSS classnames order
{activeVersion?.template}
</code>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const AddEditPromptDialog: React.FunctionComponent<AddPromptDialogProps> = ({
...(description ? { description } : {}),
},
});
}, [name, description, template]);
}, [name, description, template, promptCreateMutation.mutate]);

Check warning on line 55 in apps/opik-frontend/src/components/pages/PromptsPage/AddEditPromptDialog.tsx

View workflow job for this annotation

GitHub Actions / lint

React Hook useCallback has a missing dependency: 'promptCreateMutation'. Either include it or remove the dependency array

const editPrompt = useCallback(() => {
promptUpdateMutation.mutate({
Expand All @@ -62,7 +62,7 @@ const AddEditPromptDialog: React.FunctionComponent<AddPromptDialogProps> = ({
...(description ? { description } : {}),
},
});
}, [name, description, defaultPrompt?.id]);
}, [name, description, defaultPrompt?.id, promptUpdateMutation?.mutate]);

const onActionClick = () => {
if (isEdit) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,18 @@ const PromptsPage: React.FunctionComponent = () => {
resetDialogKeyRef.current = resetDialogKeyRef.current + 1;
}, []);

const handleRowClick = useCallback((prompt: Prompt) => {
navigate({
to: "/$workspaceName/prompts/$promptId",
params: {
promptId: prompt.id,
workspaceName,
},
});
}, []);
const handleRowClick = useCallback(
(prompt: Prompt) => {
navigate({
to: "/$workspaceName/prompts/$promptId",
params: {
promptId: prompt.id,
workspaceName,
},
});
},
[navigate, workspaceName],
);

if (isPending) {
return <Loader />;
Expand Down

0 comments on commit d6239d1

Please sign in to comment.