Repository navigation
fix(react-start): Apply Link active properties correctly on SSR when including hash #6421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
ae03dff
react: fix link active hash reactivity on SSR
nlynzaad 1d9956f
update and align tests
nlynzaad 19b2bd1
Merge branch 'refs/heads/main' into hash-ssr-reactivity
nlynzaad 89b816b
remove unnecessary change
nlynzaad 9860485
better address react re-renders and update tests
nlynzaad 20cefe2
add tests for vue
nlynzaad 9881318
react: add comment on reason for useSyncExternalStore usage
nlynzaad 8abd717
solid: revert prior fix and update tests
nlynzaad d337f00
Merge branch 'main' into hash-ssr-reactivity
nlynzaad 888749e
react: revert unnecessary change
nlynzaad 71bd46e
react: use useHydrated
nlynzaad 884460e
react: cleanup
nlynzaad 9b4bb13
Merge branch 'main' into hash-ssr-reactivity
nlynzaad File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,32 @@ | ||
| import { createFileRoute, useLocation } from '@tanstack/react-router' | ||
| import { useState } from 'react' | ||
|
|
||
| export const Route = createFileRoute('/specialChars/hash')({ | ||
| component: RouteComponent, | ||
| }) | ||
|
|
||
| function RouteComponent() { | ||
| const l = useLocation() | ||
| const [toggleHashValue, setToggleHashValue] = useState(false) | ||
| return ( | ||
| <div data-testid="special-hash-heading"> | ||
| Hello "/specialChars/hash"! | ||
| <span data-testid="special-hash">{l.hash}</span> | ||
| <div>Hello "/specialChars/hash"!</div> | ||
| <button | ||
| className={ | ||
| 'mt-2 mb-2 px-1 py-1 bg-indigo-600 text-white rounded hover:bg-indigo-700 transition duration-200' | ||
| } | ||
| data-testid="toggle-hash-button" | ||
| onClick={() => setToggleHashValue(!toggleHashValue)} | ||
| > | ||
| Toggle HashValue | ||
| </button> | ||
| <div> | ||
| {toggleHashValue && ( | ||
| <div> | ||
| Hash Value<span data-testid="special-hash">{l.hash}</span> | ||
| </div> | ||
| )} | ||
| </div> | ||
| </div> | ||
| ) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,33 @@ | ||
| import { createFileRoute, useLocation } from '@tanstack/solid-router' | ||
| import { createEffect, createSignal } from 'solid-js' | ||
| import { createSignal } from 'solid-js' | ||
|
|
||
| export const Route = createFileRoute('/specialChars/hash')({ | ||
| component: RouteComponent, | ||
| }) | ||
|
|
||
| function RouteComponent() { | ||
| const location = useLocation() | ||
| const [getHash, setHash] = createSignal('') | ||
|
|
||
| createEffect(() => { | ||
| setHash(location().hash) | ||
| }) | ||
| const [toggleHashValue, setToggleHashValue] = createSignal(false) | ||
|
|
||
| return ( | ||
| <div data-testid="special-hash-heading"> | ||
| Hello "/specialChars/hash"! | ||
| <span data-testid="special-hash">{getHash()}</span> | ||
| <div>Hello "/specialChars/hash"!</div> | ||
| <button | ||
| class={ | ||
| 'mt-2 mb-2 px-1 py-1 bg-indigo-600 text-white rounded hover:bg-indigo-700 transition duration-200' | ||
| } | ||
| data-testid="toggle-hash-button" | ||
| onClick={() => setToggleHashValue(!toggleHashValue())} | ||
| > | ||
| Toggle HashValue | ||
| </button> | ||
| <div> | ||
| {toggleHashValue() && ( | ||
| <div> | ||
| Hash Value<span data-testid="special-hash">{location().hash}</span> | ||
| </div> | ||
| )} | ||
| </div> | ||
| </div> | ||
| ) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,39 @@ | ||
| import { createFileRoute, useLocation } from '@tanstack/vue-router' | ||
| import { defineComponent, ref } from 'vue' | ||
|
|
||
| const RouteComponent = defineComponent({ | ||
| setup() { | ||
| const l = useLocation() | ||
| const toggleHashValue = ref(false) | ||
|
|
||
| const toggle = () => { | ||
| toggleHashValue.value = !toggleHashValue.value | ||
| } | ||
|
|
||
| return () => ( | ||
| <div data-testid="special-hash-heading"> | ||
| <div>Hello "/specialChars/hash"!</div> | ||
| <button | ||
| class={ | ||
| 'mt-2 mb-2 px-1 py-1 bg-indigo-600 text-white rounded hover:bg-indigo-700 transition duration-200' | ||
| } | ||
| data-testid="toggle-hash-button" | ||
| onClick={toggle} | ||
| > | ||
| Toggle HashValue | ||
| </button> | ||
| <div> | ||
| {toggleHashValue.value && ( | ||
| <div> | ||
| Hash Value<span data-testid="special-hash">{l.value.hash}</span> | ||
| </div> | ||
| )} | ||
| </div> | ||
| </div> | ||
| ) | ||
| }, | ||
| }) | ||
|
|
||
| export const Route = createFileRoute('/specialChars/hash')({ | ||
| component: RouteComponent, | ||
| }) | ||
|
|
||
| function RouteComponent() { | ||
| const l = useLocation() | ||
| return ( | ||
| <div data-testid="special-hash-heading"> | ||
| Hello "/specialChars/hash"! | ||
| <span data-testid="special-hash">{l.value.hash}</span> | ||
| </div> | ||
| ) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.