Skip to content

Commit

Permalink
Fix isSlugTaken query
Browse files Browse the repository at this point in the history
  • Loading branch information
vakila committed Aug 27, 2024
1 parent f83cf5d commit a25f951
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/Blog/Edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ export function EditablePost({ version }: { version: Doc<'versions'> | null }) {

const { getValues, setValue, setError } = form;

const slugTaken = useQuery(api.posts.isSlugTaken, {
const slugTaken = useQuery(api.posts.isSlugTaken, getValues('slug') ? {
slug: getValues('slug'),
postId: getValues('postId')
});
} : 'skip');

useEffect(() => {
if (slugTaken) {
Expand Down

0 comments on commit a25f951

Please sign in to comment.