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: useLocation return type #57

Merged
merged 1 commit into from
Dec 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The Preact Framework for Deno. Dext.ts is heavily inspired by Next.js.
To install, run the following command. This will make the `dext` CLI available in your path.

```
deno install --allow-read --allow-write --allow-env --allow-net --allow-run --unstable -f -n dext https://deno.land/x/dext@0.10.0/cli.ts
deno install --allow-read --allow-write --allow-env --allow-net --allow-run --unstable -f -n dext https://deno.land/x/dext@0.10.1/cli.ts
```

## Getting started
Expand Down
2 changes: 1 addition & 1 deletion cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { exportCommand } from "./src/export.ts";
import { serve } from "./src/serve.ts";
import { findPages, printError } from "./src/util.ts";

const VERSION = "0.10.0";
const VERSION = "0.10.1";

try {
await new Command()
Expand Down
8 changes: 4 additions & 4 deletions example/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
FROM hayd/alpine-deno:1.6.1 as builder
WORKDIR /app
RUN deno cache --unstable https://deno.land/x/dext@0.10.0/cli.ts
RUN deno cache --unstable https://deno.land/x/dext@0.10.1/cli.ts
COPY deps.ts deps.ts
COPY tsconfig.json tsconfig.json
RUN deno cache -c tsconfig.json deps.ts
COPY . .
RUN deno run --allow-read --allow-write --allow-env --allow-net --allow-run --unstable https://deno.land/x/dext@0.10.0/cli.ts build
RUN deno run --allow-read --allow-write --allow-env --allow-net --allow-run --unstable https://deno.land/x/dext@0.10.1/cli.ts build

FROM hayd/alpine-deno:1.6.1
WORKDIR /app
RUN deno cache --unstable https://deno.land/x/dext@0.10.0/cli.ts
RUN deno cache --unstable https://deno.land/x/dext@0.10.1/cli.ts
COPY --from=builder /app/.dext /app/.dext
CMD [ "deno", "run", "--allow-read", "--allow-net", "--allow-env", "--unstable", "https://deno.land/x/dext@0.10.0/cli.ts", "start" ]
CMD [ "deno", "run", "--allow-read", "--allow-net", "--allow-env", "--unstable", "https://deno.land/x/dext@0.10.1/cli.ts", "start" ]
2 changes: 1 addition & 1 deletion example/deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export type {
GetStaticDataContext,
GetStaticPaths,
PageProps,
} from "https://deno.land/x/dext@0.10.0/mod.ts";
} from "https://deno.land/x/dext@0.10.1/mod.ts";
4 changes: 2 additions & 2 deletions src/runtime/router/location.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ export const locationCtx = createContext<[string, (to: string) => void]>(
["", () => {}],
);

export function useLocation() {
export function useLocation(): readonly [string, (to: string) => void] {
// @ts-expect-error because this is a hidden variable.
if (window.__DEXT_SSR) {
return [window.location.pathname, () => {
return [window.location.pathname, (_to: string) => {
throw new TypeError("Can not navigate in SSR context.");
}];
}
Expand Down