From a4b738508f98ca49268cdea7cc082283d973c153 Mon Sep 17 00:00:00 2001 From: Dakshesh Jain Date: Wed, 21 Dec 2022 11:55:54 +0530 Subject: [PATCH] fix: selecting random emoji on create-project --- apps/app/components/project/create-project-modal.tsx | 4 ++-- apps/app/ui/emoji-icon-picker/index.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/app/components/project/create-project-modal.tsx b/apps/app/components/project/create-project-modal.tsx index 3e1d0c5a2..e93fa6d10 100644 --- a/apps/app/components/project/create-project-modal.tsx +++ b/apps/app/components/project/create-project-modal.tsx @@ -9,7 +9,7 @@ import { Dialog, Transition } from "@headlessui/react"; import projectServices from "lib/services/project.service"; import workspaceService from "lib/services/workspace.service"; // common -import { createSimilarString } from "constants/common"; +import { createSimilarString, getRandomEmoji } from "constants/common"; // constants import { NETWORK_CHOICES } from "constants/"; // fetch keys @@ -32,7 +32,7 @@ const defaultValues: Partial = { identifier: "", description: "", network: 0, - icon: "", + icon: getRandomEmoji(), }; const IsGuestCondition: React.FC<{ diff --git a/apps/app/ui/emoji-icon-picker/index.tsx b/apps/app/ui/emoji-icon-picker/index.tsx index dbe8abeee..26afe7d67 100644 --- a/apps/app/ui/emoji-icon-picker/index.tsx +++ b/apps/app/ui/emoji-icon-picker/index.tsx @@ -39,7 +39,7 @@ const EmojiIconPicker: React.FC = ({ label, value, onChange }) => { }); useEffect(() => { - if (!value) onChange(getRandomEmoji()); + if (!value || value?.length === 0) onChange(getRandomEmoji()); }, [value, onChange]); return (