mirror of
https://github.com/spacedriveapp/spacedrive
synced 2024-07-07 06:43:29 +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 */
|
/* eslint-disable react-hooks/exhaustive-deps */
|
||||||
import { useQueryClient } from '@tanstack/react-query';
|
import { useQueryClient } from '@tanstack/react-query';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useRef, useState } from 'react';
|
||||||
import { useNavigate } from 'react-router';
|
import { useNavigate } from 'react-router';
|
||||||
import {
|
import {
|
||||||
Algorithm,
|
Algorithm,
|
||||||
|
@ -55,7 +55,11 @@ export default function OnboardingCreatingLibrary() {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const created = useRef(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (created.current == true) return;
|
||||||
|
created.current = true;
|
||||||
create();
|
create();
|
||||||
const timer = setTimeout(() => {
|
const timer = setTimeout(() => {
|
||||||
setStatus('Almost done...');
|
setStatus('Almost done...');
|
||||||
|
|
Loading…
Reference in a new issue