mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
fix(SnackbarProvider): resolve context error
This commit is contained in:
1 parent
ce35041568
commit
9eefc1642a
2 files changed
+2
-4
No files matched your search
@@ -15,8 +15,6 @@ import { useNoteDetail } from './hooks/useNoteDetail';
|
||||
|
||||
import useStyles from './notes.styles';
|
||||
import InjectDebugData from '../../os/debug/InjectDebugData';
|
||||
import { useSnackbar } from '../../ui/hooks/useSnackbar';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
InjectDebugData([
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@ import React, { createContext, useState, useEffect, useRef } from 'react';
|
||||
import { IAlert } from '../hooks/useSnackbar';
|
||||
|
||||
|
||||
export const SnackbarContext = createContext({ addAlert: (a: IAlert) => {} });
|
||||
export const SnackbarContext = createContext(null);
|
||||
|
||||
function SnackbarProvider({ children }) {
|
||||
const [alert, setAlert] = useState(null);
|
||||
@@ -13,7 +13,7 @@ function SnackbarProvider({ children }) {
|
||||
clearTimeout(timer.current)
|
||||
timer.current = setTimeout(() => {
|
||||
setAlert(null)
|
||||
}, 2500);
|
||||
}, 1000);
|
||||
}
|
||||
return () => clearTimeout(timer.current)
|
||||
}, [alert]);
|
||||
|
||||
Reference in new issue
Block a user