Skip to content

Commit

Permalink
fix: umami event on navigation cause full-page reload (#742)
Browse files Browse the repository at this point in the history
  • Loading branch information
spaenleh authored Jan 28, 2025
1 parent a42d537 commit 0bc66f9
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 12 deletions.
11 changes: 9 additions & 2 deletions src/components/ui/MainMenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@ const MUILinkComponent = React.forwardRef<
HTMLAnchorElement,
MUIListItemButtonProps
>((props, ref) => {
const { id, icon, text, dataUmamiEvent, onClick, ...rest } = props;
const {
id,
icon,
text,
// dataUmamiEvent,
onClick,
...rest
} = props;
const { isMobile } = useMobileView();
const { setOpen } = useMainMenuOpenContext();

Expand All @@ -45,7 +52,7 @@ const MUILinkComponent = React.forwardRef<
<ListItemButton
component={'a'}
ref={ref}
data-umami-event={dataUmamiEvent}
// data-umami-event={dataUmamiEvent}
onClick={onClickHandler}
{...rest}
>
Expand Down
2 changes: 1 addition & 1 deletion src/modules/builder/components/main/MainMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const ResourceLinks = () => {
<ListItemButton
href={TUTORIALS_LINK}
target="_blank"
data-umami-event="sidebar-tutorials"
// data-umami-event="sidebar-tutorials"
>
<ListItemIcon>
<BookOpenTextIcon />
Expand Down
4 changes: 2 additions & 2 deletions src/routes/builder/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ const StyledLink = styled(Link)(() => ({
}));
const LinkComponent = ({ children }: { children: ReactNode }) => (
<StyledLink
data-umami-event="header-home-link"
data-umami-event-context={Context.Builder}
// data-umami-event="header-home-link"
// data-umami-event-context={Context.Builder}
to="/account"
>
{children}
Expand Down
4 changes: 2 additions & 2 deletions src/routes/builder/items/$itemId.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ const StyledLink = styled(Link)(() => ({
}));
const LinkComponent = ({ children }: { children: ReactNode }) => (
<StyledLink
data-umami-event="header-home-link"
data-umami-event-context={Context.Builder}
// data-umami-event="header-home-link"
// data-umami-event-context={Context.Builder}
to="/account"
>
{children}
Expand Down
2 changes: 1 addition & 1 deletion src/ui/Main/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ const MainWithDrawerContent = ({
>
{open ? <MenuOpen /> : <MenuIcon />}
</IconButton>
{LinkComponent && LinkComponent({ children: <LogoHeader /> })}
{LinkComponent?.({ children: <LogoHeader /> })}
{PlatformComponent}
{headerLeftContent}
</Stack>
Expand Down
6 changes: 3 additions & 3 deletions src/ui/MainMenu/MenuItem/MenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export type MenuItemProps = {
/**
* Name of the event that will be sent to Umami for tracking user actions
*/
dataUmamiEvent?: string;
// dataUmamiEvent?: string;
};

export const MenuItem = ({
Expand All @@ -33,7 +33,7 @@ export const MenuItem = ({
text,
selected,
disabled,
dataUmamiEvent,
// dataUmamiEvent,
}: MenuItemProps): JSX.Element => {
const { setOpen } = useMainMenuOpenContext();
const { isMobile } = useMobileView();
Expand All @@ -51,7 +51,7 @@ export const MenuItem = ({
onClick={onNavigate}
disabled={disabled}
selected={selected}
data-umami-event={dataUmamiEvent}
// data-umami-event={dataUmamiEvent}
>
{icon && <ListItemIcon>{icon}</ListItemIcon>}
{text && <ListItemText primary={text} />}
Expand Down
2 changes: 1 addition & 1 deletion src/ui/PlatformSwitch/PlatformSwitch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export const PlatformSwitch = ({
data-testid={platform}
href={!platformProps?.disabled ? platformProps?.href : undefined}
aria-disabled={platformProps?.disabled}
data-umami-event={`header-navigation-switch-${platform}`}
// data-umami-event={`header-navigation-switch-${platform}`}
>
<Icon
disabledColor={disabledColor}
Expand Down

0 comments on commit 0bc66f9

Please sign in to comment.