fix: selecting random emoji on create-project

This commit is contained in:
Dakshesh Jain 2022-12-21 11:55:54 +05:30
parent 18cf044e3b
commit a4b738508f
2 changed files with 3 additions and 3 deletions

View File

@ -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<IProject> = {
identifier: "",
description: "",
network: 0,
icon: "",
icon: getRandomEmoji(),
};
const IsGuestCondition: React.FC<{

View File

@ -39,7 +39,7 @@ const EmojiIconPicker: React.FC<Props> = ({ label, value, onChange }) => {
});
useEffect(() => {
if (!value) onChange(getRandomEmoji());
if (!value || value?.length === 0) onChange(getRandomEmoji());
}, [value, onChange]);
return (