Skip to content

Commit

Permalink
fixup! fix(pages): encode users ids special chars (#83) (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
seth2810 authored Sep 19, 2024
1 parent 00fe6a6 commit d435571
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/pages/user/[id]/[[...deeplink]].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,13 @@ const User: NextPage<Props> = ({
(connection) => connection.platform.name === 'Discord',
);

const userId = encodeURIComponent(user.id);

useEffect(() => {
setStats([]);

api.users
.stats(user.id, getTimeframeOptions(timeframe))
.stats(userId, getTimeframeOptions(timeframe))
.then((stats) => {
const hours = dayjs.duration(stats.durationMs).asHours();

Expand Down Expand Up @@ -277,7 +280,7 @@ const User: NextPage<Props> = ({
]);
})
.catch(() => {});
}, [timeframe, user]);
}, [timeframe, userId]);

useEffect(() => {
const refs: Record<UserScrollIntoView, RefObject<HTMLElement>> = {
Expand All @@ -293,8 +296,6 @@ const User: NextPage<Props> = ({
}, []);

// TODO: improvements
const userId = encodeURIComponent(user.id);

useEffect(() => {
api.users
.recentlyStreamed(userId)
Expand All @@ -304,7 +305,7 @@ const User: NextPage<Props> = ({

useEffect(() => {
api.users
.dateStats(user.id, {
.dateStats(userId, {
...getTimeframeOptions(timeframe),
timeZone:
user.timezone ??
Expand All @@ -319,7 +320,7 @@ const User: NextPage<Props> = ({
setDateStats(tempStats);
})
.catch(() => {});
}, [timeframe]);
}, [timeframe, userId]);

const handleSegmentSelectSpotify = (value: BetterRange) => {
event(`USER_switch_time_${value}`);
Expand Down

0 comments on commit d435571

Please sign in to comment.