Skip to content
Merged

v3 #58

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
81 changes: 0 additions & 81 deletions ADOPTION.md

This file was deleted.

1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ $ npm install --save @swan-io/chicane
## Links

- 📘 [**Documentation**](https://swan-io.github.io/chicane)
- 📗 [**Usage with other routers**](./ADOPTION.md)
- ⚖️ [**License**](./LICENSE)

## Quickstart
Expand Down
1 change: 0 additions & 1 deletion __tests__/hydration.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { render } from "@testing-library/react";
import * as React from "react";
import { afterEach, expect, test, vi } from "vitest";
import { Link, createRouter } from "../src";

Expand Down
4 changes: 2 additions & 2 deletions __tests__/router.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { act, render } from "@testing-library/react";
import * as React from "react";
import { useRef } from "react";
import { beforeEach, expect, test } from "vitest";
import { createRouter, pushUnsafe, useFocusReset } from "../src";
import { setInitialHasLocationChanged } from "../src/history";
Expand Down Expand Up @@ -111,7 +111,7 @@ test("getRoute: should match the correct route for given location", () => {
test("useFocusReset: should focus the correct element", () => {
const App = () => {
const route = useRoute(routesToMatch);
const containerRef = React.useRef(null);
const containerRef = useRef(null);

useFocusReset({ route, containerRef });

Expand Down
16 changes: 8 additions & 8 deletions __tests__/server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
* @vitest-environment node
*/

import * as React from "react";
import { renderToString } from "react-dom/server";
import { expect, test } from "vitest";
import { Link, ServerUrlProvider, createRouter } from "../src";
import { Link, createRouter } from "../src";
import { UrlProvider } from "../src/server";

const Router = createRouter({
Home: "/",
Expand Down Expand Up @@ -51,29 +51,29 @@ const App = () => {
test("Should render home page correctly", () => {
expect(
renderToString(
<ServerUrlProvider value="/">
<UrlProvider value="/">
<App />
</ServerUrlProvider>,
</UrlProvider>,
),
).toMatchSnapshot();
});

test("Should render users page correctly", () => {
expect(
renderToString(
<ServerUrlProvider value="/users">
<UrlProvider value="/users">
<App />
</ServerUrlProvider>,
</UrlProvider>,
),
).toMatchSnapshot();
});

test("Should render user page correctly", () => {
expect(
renderToString(
<ServerUrlProvider value="/users/123">
<UrlProvider value="/users/123">
<App />
</ServerUrlProvider>,
</UrlProvider>,
),
).toMatchSnapshot();
});
8 changes: 4 additions & 4 deletions docs/docs/server-side-rendering.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ title: Server-side rendering
sidebar_label: Server-side rendering
---

To render your app server-side, wrap it with `ServerUrlProvider`:
To render your app server-side, wrap it with `UrlProvider`:

```tsx {1,10-12}
import { ServerUrlProvider } from "@swan-io/chicane";
import { UrlProvider } from "@swan-io/chicane/server";
import express from "express";
import { renderToString } from "react-dom/server";
import { App } from "../client/App";
Expand All @@ -15,9 +15,9 @@ const app = express();

app.use("*", (req, res) => {
const html = renderToString(
<ServerUrlProvider value={req.originalUrl}>
<UrlProvider value={req.originalUrl}>
<App />
</ServerUrlProvider>,
</UrlProvider>,
);

// …
Expand Down
7 changes: 6 additions & 1 deletion docs/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const config = {
projectName: "chicane", // Usually your repo name.

onBrokenLinks: "throw",
onBrokenMarkdownLinks: "warn",

// Even if you don't use internationalization, you can use this field to set
// useful metadata like html lang. For example, if your site is Chinese, you
Expand All @@ -34,6 +33,12 @@ const config = {
locales: ["en"],
},

markdown: {
hooks: {
onBrokenMarkdownLinks: "warn",
},
},

presets: [
[
"classic",
Expand Down
16 changes: 8 additions & 8 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@
"write-heading-ids": "docusaurus write-heading-ids"
},
"dependencies": {
"@docusaurus/core": "3.4.0",
"@docusaurus/preset-classic": "3.4.0",
"@mdx-js/react": "^3.0.1",
"@docusaurus/core": "3.9.2",
"@docusaurus/preset-classic": "3.9.2",
"@mdx-js/react": "^3.1.1",
"clsx": "^2.1.1",
"prism-react-renderer": "^2.3.1",
"react": "^18.3.1",
"react-dom": "^18.3.1"
"prism-react-renderer": "^2.4.1",
"react": "^19.2.0",
"react-dom": "^19.2.0"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "3.4.0",
"@docusaurus/types": "3.4.0"
"@docusaurus/module-type-aliases": "3.9.2",
"@docusaurus/types": "3.9.2"
},
"browserslist": {
"production": [
Expand Down
Loading