mirror of
https://github.com/kremalicious/umami.git
synced 2025-02-14 21:10:34 +01:00
Updated team provider.
This commit is contained in:
parent
10f1b906ec
commit
d307eb4317
@ -5,21 +5,21 @@ import useModified from 'store/modified';
|
||||
|
||||
export const TeamContext = createContext(null);
|
||||
|
||||
export function TeamProvider({ teamId, children }: { teamId: string; children: ReactNode }) {
|
||||
export function TeamProvider({ teamId, children }: { teamId?: string; children: ReactNode }) {
|
||||
const modified = useModified(state => state?.[`team:${teamId}`]);
|
||||
const { data: team, isLoading, isFetching, refetch } = useTeam(teamId);
|
||||
|
||||
useEffect(() => {
|
||||
if (modified) {
|
||||
if (teamId && modified) {
|
||||
refetch();
|
||||
}
|
||||
}, [modified]);
|
||||
}, [teamId, modified]);
|
||||
|
||||
if (isFetching && isLoading) {
|
||||
return <Loading />;
|
||||
}
|
||||
|
||||
if (!team) {
|
||||
if (teamId && !team) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user