Skip to content

Commit

Permalink
fix: remove too much context on user
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnaud AMBROSELLI committed Feb 8, 2024
1 parent 8e74a95 commit 512f072
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
12 changes: 10 additions & 2 deletions app/src/recoil/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@ import { atom } from 'recoil';
export const userState = atom({
key: 'userState',
default: null,
effects: [({ onSet }) => onSet((user) => Sentry.setUser(user))],
effects: [
({ onSet }) =>
onSet((user) =>
Sentry.setUser({
id: user?._id,
email: user?.email,
})
),
],
});

export const organisationState = atom({
Expand All @@ -26,5 +34,5 @@ export const usersState = atom({
export const currentTeamState = atom({
key: 'currentTeamState',
default: null,
effects: [({ onSet }) => onSet((currentTeam) => Sentry.setContext('currentTeam', currentTeam))],
effects: [({ onSet }) => onSet((currentTeam) => Sentry.setTag('currentTeam', currentTeam?._id ?? ''))],
});
11 changes: 10 additions & 1 deletion dashboard/src/recoil/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@ import type { TeamInstance } from '../types/team';
export const userState = atom<UserInstance | null>({
key: 'userState',
default: null,
effects: [({ onSet }) => onSet((user) => AppSentry.setUser(user))],
effects: [
({ onSet }) =>
onSet((user) =>
AppSentry.setUser({
id: user?._id,
email: user?.email,
})
),
],
});

export const userAuthentifiedState = selector<UserInstance>({
Expand Down Expand Up @@ -52,6 +60,7 @@ export const usersState = atom<UserInstance[]>({
export const currentTeamState = atom<TeamInstance | null>({
key: 'currentTeamState',
default: null,
effects: [({ onSet }) => onSet((currentTeam) => AppSentry.setTag('currentTeam', currentTeam?._id ?? ''))],
});

export const currentTeamAuthentifiedState = selector<TeamInstance>({
Expand Down

0 comments on commit 512f072

Please sign in to comment.