Skip to content
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

fix: a bug 4956 #6778

Merged
merged 16 commits into from
Sep 11, 2024
5 changes: 5 additions & 0 deletions .changeset/popular-dragons-greet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@builder.io/qwik': path
---

fix: SSG Link componet strips search parameters
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,9 @@ export const QwikCityProvider = component$<QwikCityProps>((props) => {
const [routeName, params, mods, menu] = loadedRoute;
const contentModules = mods as ContentModule[];
const pageModule = contentModules[contentModules.length - 1] as PageModule;

if (navigation.dest.search) {
trackUrl.search = navigation.dest.search;
}
// Update route location
routeLocation.prevUrl = prevUrl;
routeLocation.url = trackUrl;
Expand Down
17 changes: 17 additions & 0 deletions starters/apps/qwikcity-test/src/routes/issue4956/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { component$, useStore, useTask$ } from "@builder.io/qwik";
import { useLocation } from "@builder.io/qwik-city";

export default component$((props) => {
const loc = useLocation();
const state = useStore({ id: "" });
useTask$(({ track }) => {
track(() => loc.url.searchParams);
state.id = loc.url.searchParams.get("id") || "";
});
return (
<div>
<h1>Issue 4956</h1>
<div id="routeId">{state.id}</div>
</div>
);
});
7 changes: 7 additions & 0 deletions starters/e2e/qwikcity/nav.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,13 @@ test.describe("actions", () => {
);
});

test("issue4956", async ({ page }) => {
await page.goto("/qwikcity-test/issue4956?id=1");
const textContent = await page.locator("#routeId");

await expect(textContent).toHaveText("1");
});

test("issue4531", async ({ page }) => {
const res = await page.goto("/qwikcity-test/issue4531/");
await expect(page.locator("#route")).toHaveText("should render");
Expand Down