Skip to content

Commit

Permalink
feat: add use effect to register dialog text area default value change
Browse files Browse the repository at this point in the history
  • Loading branch information
mrnossiom committed Sep 15, 2023
1 parent a36e065 commit e291496
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/digests/block-card/text-card/TextCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default function BlockTextCard({ block, isEditable = false }: Props) {
setIsOpen={setIsEditDialogOpen}
bookmarkDigest={block}
defaultValues={{
...(block.text && { text: block.text }),
text: block.text,
}}
/>
</>
Expand Down
6 changes: 4 additions & 2 deletions src/components/digests/dialog/EditTextBlockDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { useTeam } from '@/contexts/TeamContext';
import useCustomToast from '@/hooks/useCustomToast';
import useTransitionRefresh from '@/hooks/useTransitionRefresh';
import api from '@/lib/api';
import { getTweetId, isTwitterLink } from '@/utils/link';
import { BookmarkDigestStyle } from '@prisma/client';
import { AxiosError, AxiosResponse } from 'axios';
import { useParams } from 'next/navigation';
import React, { useEffect } from 'react';
Expand Down Expand Up @@ -41,6 +39,10 @@ export default function EditTextBlockDialog({
const { successToast, errorToast } = useCustomToast();
const { isRefreshing, refresh } = useTransitionRefresh();

useEffect(() => {
reset(defaultValues);
}, [defaultValues, reset]);

const params = useParams();
const { id: teamId } = useTeam();

Expand Down

0 comments on commit e291496

Please sign in to comment.