mirror of https://github.com/buster-so/buster.git
Merge pull request #947 from buster-so/big-nate-bus-1740-error-on-a-teams-call
remove get user from app
This commit is contained in:
commit
7fd25d2c90
|
@ -52,9 +52,9 @@ const options: Partial<PostHogConfig> = {
|
|||
|
||||
const PosthogWrapper: React.FC<PropsWithChildren> = ({ children }) => {
|
||||
const user = useGetUserBasicInfo();
|
||||
const { data: userTeams } = useGetUserTeams({ userId: user?.id ?? '' });
|
||||
const userOrganizations = useGetUserOrganization();
|
||||
const team = userTeams?.[0];
|
||||
const userOrganizationId = userOrganizations?.id || '';
|
||||
const userOrganizationName = userOrganizations?.name || '';
|
||||
|
||||
const [posthogModules, setPosthogModules] = useState<{
|
||||
posthog: typeof import('posthog-js').default;
|
||||
|
@ -84,7 +84,7 @@ const PosthogWrapper: React.FC<PropsWithChildren> = ({ children }) => {
|
|||
|
||||
// Initialize PostHog when modules are loaded and user data is available
|
||||
useEffect(() => {
|
||||
if (POSTHOG_KEY && !isServer && user && posthogModules?.posthog && team) {
|
||||
if (POSTHOG_KEY && !isServer && user && posthogModules?.posthog) {
|
||||
const { posthog } = posthogModules;
|
||||
|
||||
if (posthog.__loaded) {
|
||||
|
@ -97,11 +97,10 @@ const PosthogWrapper: React.FC<PropsWithChildren> = ({ children }) => {
|
|||
posthog.identify(email, {
|
||||
user,
|
||||
organization: userOrganizations,
|
||||
team,
|
||||
});
|
||||
posthog.group(team?.id, team?.name);
|
||||
posthog.group(userOrganizationId, userOrganizationName);
|
||||
}
|
||||
}, [user?.id, team?.id, posthogModules]);
|
||||
}, [user?.id, userOrganizationId, userOrganizationName, posthogModules]);
|
||||
|
||||
// Show children while loading or if modules failed to load
|
||||
if (isLoading || !posthogModules) {
|
||||
|
|
|
@ -60,12 +60,12 @@ const useRouteToSegments = (): UserSegmentsApps => {
|
|||
if (isDatasets) {
|
||||
return UserSegmentsApps.DATASETS;
|
||||
}
|
||||
const isTeams = match({
|
||||
from: '/app/settings/users/$userId/teams',
|
||||
});
|
||||
if (isTeams) {
|
||||
return UserSegmentsApps.TEAMS;
|
||||
}
|
||||
// const isTeams = match({
|
||||
// from: '/app/settings/users/$userId/teams',
|
||||
// });
|
||||
// if (isTeams) {
|
||||
// return UserSegmentsApps.TEAMS;
|
||||
// }
|
||||
|
||||
return UserSegmentsApps.OVERVIEW;
|
||||
}, []);
|
||||
|
|
|
@ -13,7 +13,7 @@ export enum UserSegmentsApps {
|
|||
DATASET_GROUPS = 'Dataset Groups',
|
||||
DATASETS = 'Datasets',
|
||||
ATTRIBUTES = 'Attributes',
|
||||
TEAMS = 'Teams',
|
||||
//TEAMS = 'Teams',
|
||||
}
|
||||
|
||||
export const UserSegments: React.FC<{
|
||||
|
@ -80,16 +80,16 @@ export const UserSegments: React.FC<{
|
|||
// },
|
||||
// },
|
||||
// },
|
||||
{
|
||||
label: 'Teams',
|
||||
value: UserSegmentsApps.TEAMS,
|
||||
link: {
|
||||
to: `/app/settings/users/$userId/teams`,
|
||||
params: {
|
||||
userId,
|
||||
},
|
||||
},
|
||||
},
|
||||
// {
|
||||
// label: 'Teams',
|
||||
// value: UserSegmentsApps.TEAMS,
|
||||
// link: {
|
||||
// to: `/app/settings/users/$userId/teams`,
|
||||
// params: {
|
||||
// userId,
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
]),
|
||||
[userId]
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue