Change debounce return to be optional

This commit is contained in:
Mitchell McCaffrey 2021-07-18 09:12:32 +10:00
parent 830798dc74
commit ac99c9af4a
2 changed files with 5 additions and 2 deletions

View File

@ -134,6 +134,9 @@ export function AssetURLsProvider({ children }: { children: React.ReactNode }) {
// Update the asset keys to load when a url is added without an asset attached
useEffect(() => {
if (!loadingDebouncedAssetURLs) {
return;
}
let keysToLoad: string[] = [];
for (let url of Object.values(loadingDebouncedAssetURLs)) {
if (url.url === null) {

View File

@ -1,7 +1,7 @@
import { useEffect, useState } from "react";
function useDebounce<Type>(value: Type, delay: number): Type {
const [debouncedValue, setDebouncedValue] = useState<Type>(value);
function useDebounce<Type>(value: Type, delay: number): Type | undefined {
const [debouncedValue, setDebouncedValue] = useState<Type>();
useEffect(() => {
const timeout = setTimeout(() => {