Skip to content

Commit

Permalink
[preact-iso] Support manual URL via <LocationProvider url="/" /> (#534)
Browse files Browse the repository at this point in the history
* [preact-iso] Support manual URL via <LocationProvider url="/" />

* Create real-horses-promise.md
  • Loading branch information
developit committed Apr 11, 2021
1 parent 961a539 commit 8d5d1d8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/real-horses-promise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"preact-iso": patch
---

[preact-iso] Support setting a manual URL via `<LocationProvider url="/" />`
2 changes: 1 addition & 1 deletion packages/preact-iso/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const exec = (url, route, matches) => {
};

export function LocationProvider(props) {
const [url, route] = useReducer(UPDATE, location.pathname + location.search);
const [url, route] = useReducer(UPDATE, props.url || location.pathname + location.search);
const wasPush = push === true;

const value = useMemo(() => {
Expand Down

0 comments on commit 8d5d1d8

Please sign in to comment.