Skip to content

Commit

Permalink
fix: search selection
Browse files Browse the repository at this point in the history
  • Loading branch information
oae committed Oct 13, 2022
1 parent 93154a5 commit 216b926
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/addManga/mangaSearchResult.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createStyles, Image, SimpleGrid, Text, UnstyledButton } from '@mantine/core';
import { useUncontrolled } from '@mantine/hooks';
import { useState } from 'react';
import { useEffect, useState } from 'react';

const useStyles = createStyles((theme, { checked, disabled }: { checked: boolean; disabled: boolean }) => ({
button: {
Expand Down Expand Up @@ -111,6 +111,10 @@ export function MangaSearchResult({
}) {
const [selected, setSelected] = useState<IMangaSearchResult>();

useEffect(() => {
setSelected(undefined);
}, [items]);

return (
<SimpleGrid
cols={2}
Expand Down
2 changes: 2 additions & 0 deletions src/components/addManga/steps/searchStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export function SearchStep({ form }: { form: UseFormReturnType<FormType> }) {
if (!form.isValid('query')) {
return;
}
form.setFieldValue('mangaOrder', -1);
form.setFieldValue('mangaTitle', '');
setLoading(true);
const result = await ctx.manga.search.fetch({
keyword: form.values.query,
Expand Down

0 comments on commit 216b926

Please sign in to comment.