-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
[STAGE-2] incomplete implementationRemove this label when implementation is completeRemove this label when implementation is complete[STAGE-2] not fully covered by tests yetRemove this label when tests are verified to cover the implementationRemove this label when tests are verified to cover the implementation[STAGE-2] unresolved discussions leftRemove this label when all critical discussions are resolved on the issueRemove this label when all critical discussions are resolved on the issue[STAGE-3] docs changes not added yetRemove this label when the necessary documentation for the feature / change is addedRemove this label when the necessary documentation for the feature / change is added[STAGE-3] missing 2 reviews for RFC PRsRemove this label when at least 2 core team members reviewed and approved the RFC implementationRemove this label when at least 2 core team members reviewed and approved the RFC implementation
Description
Which component is affected?
Qwik City (routing)
Describe the bug
I am using client-side routing and navigating the page using id's and scrolling to the view.
I navigate using the useNavigate
hook and trying to access the id (or full url) value in useLocation
. Unfortunatelly useLocation
doesn't include information that starts with a '#'.
eg.
const nav = useNavigate();
const handleClick = $(() => {
nav(`#section`);
});
After that url looks correctly
https://localhost:4200/#section
But cannot find any hash information
const loc = useLocation();
console.log(loc)
{
hash: "",
host: "localhost:4200",
hostname: "localhost",
href: "http://localhost:4200/",
origin: "http://localhost:4200",
password: "",
pathname: "/",
port: "4200",
protocol:"http:",
search: "",
...
}
any thoughts?
Reproduction
https://stackblitz.com/edit/qwik-starter-casjao?file=src%2Froutes%2Findex.tsx
Steps to reproduce
- Navigate programmatically using
useNavigate
hook and direct to the html element's id (eg.nav('#hash')
) - Try to access hash value or full url using
useLocation
hook
System Info
System:
OS: macOS 13.0.1
CPU: (8) arm64 Apple M1 Pro
Memory: 77.41 MB / 32.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 19.3.0 - ~/.nvm/versions/node/v19.3.0/bin/node
Yarn: 1.22.19 - /opt/homebrew/bin/yarn
npm: 9.2.0 - ~/.nvm/versions/node/v19.3.0/bin/npm
Browsers:
Chrome: 114.0.5735.198
Edge: 113.0.1774.57
Safari: 16.1
npmPackages:
@builder.io/qwik: ~1.2.6 => 1.2.6
@builder.io/qwik-city: ~1.2.6 => 1.2.6
undici: ^5.22.0 => 5.22.1
vite: ^4.3.9 => 4.3.9
Additional Information
I think it might be affected by this PR QwikDev/qwik#4550
adrianoleszczak-innio, colexbruhn and schoero
Metadata
Metadata
Assignees
Labels
[STAGE-2] incomplete implementationRemove this label when implementation is completeRemove this label when implementation is complete[STAGE-2] not fully covered by tests yetRemove this label when tests are verified to cover the implementationRemove this label when tests are verified to cover the implementation[STAGE-2] unresolved discussions leftRemove this label when all critical discussions are resolved on the issueRemove this label when all critical discussions are resolved on the issue[STAGE-3] docs changes not added yetRemove this label when the necessary documentation for the feature / change is addedRemove this label when the necessary documentation for the feature / change is added[STAGE-3] missing 2 reviews for RFC PRsRemove this label when at least 2 core team members reviewed and approved the RFC implementationRemove this label when at least 2 core team members reviewed and approved the RFC implementation
Type
Projects
Status
In Progress (STAGE 2)