mirror of
https://github.com/makeplane/plane.git
synced 2026-02-11 08:39:05 -06:00
[WEB-3699]fix: create link modal text flicker (#6860)
This commit is contained in:
@@ -21,7 +21,6 @@ export type TLinkCreateEditModal = {
|
||||
handleOnClose?: () => void;
|
||||
linkOperations: TLinkOperationsModal;
|
||||
preloadedData?: TLinkCreateFormFieldOptions;
|
||||
setLinkData: (link: TLink | undefined) => void;
|
||||
};
|
||||
|
||||
const defaultValues: TLinkCreateFormFieldOptions = {
|
||||
@@ -31,7 +30,7 @@ const defaultValues: TLinkCreateFormFieldOptions = {
|
||||
|
||||
export const LinkCreateUpdateModal: FC<TLinkCreateEditModal> = observer((props) => {
|
||||
// props
|
||||
const { setLinkData, isModalOpen, handleOnClose, linkOperations, preloadedData } = props;
|
||||
const { isModalOpen, handleOnClose, linkOperations, preloadedData } = props;
|
||||
// react hook form
|
||||
const {
|
||||
formState: { errors, isSubmitting },
|
||||
@@ -45,7 +44,6 @@ export const LinkCreateUpdateModal: FC<TLinkCreateEditModal> = observer((props)
|
||||
|
||||
const onClose = () => {
|
||||
if (handleOnClose) handleOnClose();
|
||||
setLinkData(undefined);
|
||||
};
|
||||
|
||||
const handleFormSubmit = async (formData: TLinkCreateFormFieldOptions) => {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { useCallback } from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import useSWR from "swr";
|
||||
import { Plus } from "lucide-react";
|
||||
@@ -16,6 +17,11 @@ export const DashboardQuickLinks = observer((props: THomeWidgetProps) => {
|
||||
} = useHome();
|
||||
const { t } = useTranslation();
|
||||
|
||||
const handleCreateLinkModal = useCallback(() => {
|
||||
toggleLinkModal(true);
|
||||
setLinkData(undefined);
|
||||
}, []);
|
||||
|
||||
useSWR(
|
||||
workspaceSlug ? `HOME_LINKS_${workspaceSlug}` : null,
|
||||
workspaceSlug ? () => fetchLinks(workspaceSlug.toString()) : null,
|
||||
@@ -32,15 +38,12 @@ export const DashboardQuickLinks = observer((props: THomeWidgetProps) => {
|
||||
handleOnClose={() => toggleLinkModal(false)}
|
||||
linkOperations={linkOperations}
|
||||
preloadedData={linkData}
|
||||
setLinkData={setLinkData}
|
||||
/>
|
||||
<div className="mb-2">
|
||||
<div className="flex items-center justify-between mb-4">
|
||||
<div className="text-base font-semibold text-custom-text-350">{t("home.quick_links.title_plural")}</div>
|
||||
<button
|
||||
onClick={() => {
|
||||
toggleLinkModal(true);
|
||||
}}
|
||||
onClick={handleCreateLinkModal}
|
||||
className="flex gap-1 text-sm font-medium text-custom-primary-100 my-auto"
|
||||
>
|
||||
<Plus className="size-4 my-auto" /> <span>{t("home.quick_links.add")}</span>
|
||||
|
||||
Reference in New Issue
Block a user