Skip to content

Commit

Permalink
fix: update profile interests type to be optional and add guards
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonroberts committed Aug 8, 2024
1 parent df9ae69 commit b59a6c7
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion components/organisms/TopNav/top-nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const TopNav = () => {
const Nav = ({ className }: { className?: string }) => {
const { user } = useSupabaseAuth();
const { data: gitHubUser } = useFetchUser(user?.user_metadata.user_name);
const userInterest = gitHubUser?.interests.split(",")[0] || "javascript";
const userInterest = gitHubUser?.interests?.split(",")[0] || "javascript";
const router = useRouter();

const explorePageUrlPattern = /^(\/explore\/topic).*\/(dashboard|reports|contributors|activity).*/g;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ const UserSettingsPage = ({ user }: UserSettingsPageProps) => {
receive_collaboration: insightsUser?.receive_collaboration,
receive_product_updates: insightsUser?.receive_product_updates,
});
setSelectedInterest(insightsUser?.interests?.split(","));
setSelectedInterest(insightsUser?.interests?.split(",") || []);
setDisplayLocalTime(insightsUser?.display_local_time);
setTimezone(insightsUser?.timezone || "");
}
Expand Down
2 changes: 1 addition & 1 deletion components/shared/AppSidebar/AppSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const AppSideBar = ({ workspaceId, hideSidebar, sidebarCollapsed }: AppSi
});

const { data: gitHubUser } = useFetchUser(user?.user_metadata.user_name);
const userInterest = gitHubUser?.interests.split(",")[0] || "javascript";
const userInterest = gitHubUser?.interests?.split(",")[0] || "javascript";

return (
// TODO: get rid of the z-index. There is grid content like the avatars and paged data text that bleed through the sidebar atm.
Expand Down
2 changes: 1 addition & 1 deletion next-types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ interface DbUser {
readonly location: string;
readonly display_local_time: boolean;
readonly name: string;
readonly interests: string;
readonly interests?: string;
readonly receive_collaboration: boolean;
readonly display_email: boolean;
readonly timezone: string;
Expand Down

0 comments on commit b59a6c7

Please sign in to comment.