WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 4a89670

Browse files
committed
Refactor domain check mutation to use ref object
1 parent 29f3f23 commit 4a89670

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

apps/web/app/(org)/dashboard/settings/organization/components/CustomDomainDialog/CustomDomainDialog.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,11 @@ const CustomDomainDialog = ({
138138
const router = useRouter();
139139
const dialogRef = useRef<HTMLDivElement | null>(null);
140140
const confettiRef = useRef<ConfettiRef>(null);
141-
142141
const pollInterval = useRef<NodeJS.Timeout | undefined>(undefined);
142+
const checkDomainMutationRef = useRef<{
143+
mutate: (args: { orgId: string; showToasts: boolean }) => void;
144+
isPending: boolean;
145+
} | null>(null);
143146

144147
const updateDomainMutation = useMutation({
145148
mutationFn: async ({
@@ -218,6 +221,11 @@ const CustomDomainDialog = ({
218221
},
219222
});
220223

224+
checkDomainMutationRef.current = {
225+
mutate: checkDomainMutation.mutate,
226+
isPending: checkDomainMutation.isPending,
227+
};
228+
221229
const [stepState, dispatch] = useReducer(stepReducer, {
222230
currentIndex: 0,
223231
totalSteps: STEP_CONFIGS.length,
@@ -267,15 +275,14 @@ const CustomDomainDialog = ({
267275
)
268276
return;
269277

270-
checkDomainMutation.mutate({
278+
checkDomainMutationRef.current?.mutate({
271279
orgId: activeOrganization.organization.id,
272280
showToasts,
273281
});
274282
},
275283
[
276284
activeOrganization?.organization.id,
277285
activeOrganization?.organization.customDomain,
278-
checkDomainMutation,
279286
],
280287
);
281288

0 commit comments

Comments
 (0)