Adding mount logic to error handler

This commit is contained in:
Beau Cameron 2022-10-10 10:06:01 -06:00
parent ff7920e52a
commit 913a3b0fa8
1 changed files with 6 additions and 2 deletions

View File

@ -61,7 +61,9 @@ const useDocuments = () => {
); );
} }
} catch (err) { } catch (err) {
setError(true); if (mounted) {
setError(true);
}
Logger.write( Logger.write(
`${LOG_SOURCE} (getting files useEffect) - ${JSON.stringify(err)} - `, `${LOG_SOURCE} (getting files useEffect) - ${JSON.stringify(err)} - `,
LogLevel.Error LogLevel.Error
@ -114,7 +116,9 @@ const useDocuments = () => {
setError(false); setError(false);
} }
} catch (err) { } catch (err) {
setError(true); if (mounted) {
setError(true);
}
Logger.write( Logger.write(
`${LOG_SOURCE} (updating titles) - ${JSON.stringify(err)} - `, `${LOG_SOURCE} (updating titles) - ${JSON.stringify(err)} - `,
LogLevel.Error LogLevel.Error