fix: fetch states only when the dropdown is opened (#1684)

This commit is contained in:
Aaryan Khandelwal 2023-07-26 23:20:44 +05:30 committed by GitHub
parent fd9dcfa2ec
commit d6f3c2515a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 51 additions and 38 deletions

View file

@ -49,8 +49,8 @@ const StatesSettings: NextPage = () => {
? () => stateService.getStates(workspaceSlug as string, projectId as string)
: null
);
const orderedStateGroups = orderStateGroups(states ?? {});
const statesList = getStatesList(orderedStateGroups ?? {});
const orderedStateGroups = orderStateGroups(states);
const statesList = getStatesList(orderedStateGroups);
return (
<>
@ -79,7 +79,7 @@ const StatesSettings: NextPage = () => {
<p className="text-custom-text-200">Manage the states of this project.</p>
</div>
<div className="col-span-12 space-y-8 sm:col-span-7">
{states && projectDetails ? (
{states && projectDetails && orderedStateGroups ? (
Object.keys(orderedStateGroups).map((key) => {
if (orderedStateGroups[key].length !== 0)
return (
@ -114,7 +114,7 @@ const StatesSettings: NextPage = () => {
key={state.id}
index={index}
state={state}
statesList={statesList}
statesList={statesList ?? []}
handleEditState={() => setSelectedState(state.id)}
handleDeleteState={() => setSelectDeleteState(state.id)}
user={user}