mirror of
https://github.com/umami-software/umami.git
synced 2025-12-06 01:18:00 +01:00
Updated team provider.
This commit is contained in:
parent
10f1b906ec
commit
d307eb4317
1 changed files with 4 additions and 4 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue