mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-05 06:28:51 +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 useStyles from './notes.styles';
|
||||||
import InjectDebugData from '../../os/debug/InjectDebugData';
|
import InjectDebugData from '../../os/debug/InjectDebugData';
|
||||||
import { useSnackbar } from '../../ui/hooks/useSnackbar';
|
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
|
|
||||||
InjectDebugData([
|
InjectDebugData([
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import React, { createContext, useState, useEffect, useRef } from 'react';
|
|||||||
import { IAlert } from '../hooks/useSnackbar';
|
import { IAlert } from '../hooks/useSnackbar';
|
||||||
|
|
||||||
|
|
||||||
export const SnackbarContext = createContext({ addAlert: (a: IAlert) => {} });
|
export const SnackbarContext = createContext(null);
|
||||||
|
|
||||||
function SnackbarProvider({ children }) {
|
function SnackbarProvider({ children }) {
|
||||||
const [alert, setAlert] = useState(null);
|
const [alert, setAlert] = useState(null);
|
||||||
@@ -13,7 +13,7 @@ function SnackbarProvider({ children }) {
|
|||||||
clearTimeout(timer.current)
|
clearTimeout(timer.current)
|
||||||
timer.current = setTimeout(() => {
|
timer.current = setTimeout(() => {
|
||||||
setAlert(null)
|
setAlert(null)
|
||||||
}, 2500);
|
}, 1000);
|
||||||
}
|
}
|
||||||
return () => clearTimeout(timer.current)
|
return () => clearTimeout(timer.current)
|
||||||
}, [alert]);
|
}, [alert]);
|
||||||
|
|||||||
Reference in new issue
Block a user