mirror of
https://github.com/spacedriveapp/spacedrive
synced 2024-07-04 13:23:28 +00:00
[ENG-376] Fix double libraries being created during onboarding (#582)
* ensure the library creation `useEffect` only ever fires once * use an early return
This commit is contained in:
parent
c65d92ee4c
commit
ad157f58a5
|
@ -1,6 +1,6 @@
|
|||
/* eslint-disable react-hooks/exhaustive-deps */
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import { useNavigate } from 'react-router';
|
||||
import {
|
||||
Algorithm,
|
||||
|
@ -55,7 +55,11 @@ export default function OnboardingCreatingLibrary() {
|
|||
return;
|
||||
};
|
||||
|
||||
const created = useRef(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (created.current == true) return;
|
||||
created.current = true;
|
||||
create();
|
||||
const timer = setTimeout(() => {
|
||||
setStatus('Almost done...');
|
||||
|
|
Loading…
Reference in a new issue