-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #87 from DefGuard/disable-manual-config
- Loading branch information
Showing
9 changed files
with
100 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,4 +45,11 @@ | |
} | ||
} | ||
} | ||
|
||
#loader { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 500px; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,27 @@ | ||
import { useEffect, useRef } from 'react'; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
export const removeNulls = (obj: any) => { | ||
return JSON.parse(JSON.stringify(obj), (_, value) => { | ||
if (value == null) return undefined; | ||
return value; | ||
}); | ||
}; | ||
|
||
/** | ||
Under normal circumstances, useEffect should run only once when passed an empty dependency array. | ||
However, in dev mode with react strict mode enabled, everything is rendered twice for debugging purposes. | ||
This also causes useEffect to run twice, which is not always desirable. | ||
This custom hook ensures that the effect runs only once in dev mode as well. | ||
*/ | ||
export default function useEffectOnce(fn: () => void) { | ||
const isMounted = useRef(false); | ||
useEffect(() => { | ||
if (isMounted.current) { | ||
return; | ||
} | ||
|
||
fn(); | ||
isMounted.current = true; | ||
}, [fn]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters