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:
Nate Kelley 2025-09-16 16:58:18 -06:00 committed by GitHub
commit 7fd25d2c90
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 22 additions and 23 deletions

View File

@ -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) {

View File

@ -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;
}, []);

View File

@ -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]
);