Skip to content

Commit

Permalink
fix(routing): add data attribute to links
Browse files Browse the repository at this point in the history
This way you can distinguish xstate-tree links from plain a tags
  • Loading branch information
UberMouse committed Sep 18, 2023
1 parent 88a1023 commit db13fae
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/routing/Link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ function LinkInner<TRoute extends AnyRoute>(
onMouseDown={onMouseDown ?? _onMouseDown}
onMouseEnter={onMouseEnter ?? _onMouseEnter}
onMouseLeave={onMouseLeave ?? _onMouseLeave}
data-xstate-tree
onClick={(e) => {
if (props.onClick?.(e) === false) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ exports[`Test app renders the initial app 1`] = `
</p>
<a
data-testid="swap-to-other-machine"
data-xstate-tree="true"
href="/settings/"
>
Swap to settings
Expand Down

0 comments on commit db13fae

Please sign in to comment.