Skip to content

Commit

Permalink
fix: cleanup form after link navigation (QwikDev#2599)
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat authored Jan 9, 2023
1 parent 3d433a6 commit 4a9f4cd
Show file tree
Hide file tree
Showing 8 changed files with 213 additions and 255 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@
"prepare": "husky install"
},
"devDependencies": {
"@builder.io/partytown": "0.7.3",
"@builder.io/partytown": "0.7.4",
"@microsoft/api-extractor": "7.33.7",
"@napi-rs/cli": "2.12.1",
"@napi-rs/triples": "1.1.0",
"@node-rs/helper": "1.3.3",
"@octokit/action": "3.18.1",
"@playwright/test": "1.29.1",
"@playwright/test": "1.29.2",
"@types/brotli": "1.3.1",
"@types/cross-spawn": "6.0.2",
"@types/eslint": "8.4.10",
Expand All @@ -82,7 +82,7 @@
"create-qwik": "workspace:*",
"cross-spawn": "7.0.3",
"cz-conventional-changelog": "3.3.0",
"esbuild": "0.16.12",
"esbuild": "0.16.16",
"eslint": "8.31.0",
"eslint-plugin-no-only-tests": "3.1.0",
"execa": "6.1.0",
Expand All @@ -93,7 +93,7 @@
"node-fetch": "3.3.0",
"ora": "6.1.2",
"path-browserify": "1.0.1",
"prettier": "2.8.1",
"prettier": "2.8.2",
"pretty-quick": "^3.1.3",
"prompts": "2.4.2",
"rollup": "3.9.1",
Expand All @@ -104,7 +104,7 @@
"typescript": "4.9.4",
"undici": "5.14.0",
"uvu": "0.5.6",
"vite": "4.0.3",
"vite": "4.0.4",
"vite-tsconfig-paths": "4.0.3",
"watchlist": "0.3.1",
"which-pm-runs": "1.1.0"
Expand Down
8 changes: 4 additions & 4 deletions packages/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@algolia/autocomplete-core": "1.7.3",
"@algolia/autocomplete-shared": "1.7.3",
"@algolia/client-search": "4.14.2",
"@builder.io/partytown": "0.7.3",
"@builder.io/partytown": "0.7.4",
"@builder.io/qwik": "0.16.2",
"@builder.io/qwik-city": "0.1.0-beta8",
"@builder.io/sdk-qwik": "0.0.37",
Expand All @@ -34,16 +34,16 @@
"fflate": "0.7.4",
"gray-matter": "4.0.3",
"node-fetch": "3.3.0",
"postcss": "8.4.20",
"postcss": "8.4.21",
"prism-themes": "1.9.0",
"prismjs": "1.29.0",
"puppeteer": "^19.4.1",
"puppeteer": "^19.5.0",
"tailwindcss": "3.2.4",
"tsm": "2.3.0",
"typescript": "4.9.4",
"undici": "5.14.0",
"uvu": "0.5.6",
"vite": "4.0.3",
"vite": "4.0.4",
"wrangler": "^2.6.2"
},
"author": "Builder.io Team",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,10 @@ function handleErrors<T>(run: QwikCityRun<T>): QwikCityRun<T> {
console.error(e);
const status = requestEv.status();
const html = getErrorHtml(status, e);
if (requestEv.headersSent) {
const writableStream = requestEv.getWritableStream();
if (!writableStream.locked) {
return writableStream.close();
}
} else {
if (!requestEv.headersSent) {
requestEv.html(status, html);
} else {
// STREAM CLOSED
}
}
)
Expand Down
2 changes: 1 addition & 1 deletion packages/qwik-city/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
"unified": "10.1.2",
"unist-util-visit": "4.1.1",
"uvu": "0.5.6",
"vite": "4.0.3",
"vite": "4.0.4",
"yaml": "2.2.1"
},
"peerDependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/qwik-city/runtime/src/qwik-city-component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export const QwikCityProvider = component$<QwikCityProps>(() => {
navPath.value = '';
navPath.value = value;
}
actionState.value = undefined;
routeLocation.isPending = true;
});

Expand Down
13 changes: 10 additions & 3 deletions packages/qwik-city/runtime/src/use-endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,24 @@ export const loadClientData = async (
const pagePathname = url.pathname;
const pageSearch = url.search;
const clientDataPath = getClientDataPath(pagePathname, pageSearch, action);
let qData = action ? undefined : CLIENT_DATA_CACHE.get(clientDataPath);
let qData = undefined;
if (!action) {
qData = CLIENT_DATA_CACHE.get(clientDataPath);
}

dispatchPrefetchEvent({
links: [pagePathname],
});

if (!qData) {
const options: RequestInit | undefined = action
const actionData = action?.data;
if (action) {
action.data = undefined;
}
const options: RequestInit | undefined = actionData
? {
method: 'POST',
body: action.data,
body: actionData,
}
: undefined;
qData = fetch(clientDataPath, options).then((rsp) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/qwik-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"react": "18.2.0",
"react-dom": "18.2.0",
"typescript": "4.9.4",
"vite": "4.0.3"
"vite": "4.0.4"
},
"peerDependencies": {
"@builder.io/qwik": ">=0.1.11",
Expand Down
Loading

0 comments on commit 4a9f4cd

Please sign in to comment.