Skip to content

Commit

Permalink
Merge branch 'release-next'
Browse files Browse the repository at this point in the history
  • Loading branch information
chaance committed Sep 21, 2022
2 parents 9ed384c + d405320 commit f3009f5
Show file tree
Hide file tree
Showing 27 changed files with 386 additions and 105 deletions.
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://unpkg.com/@changesets/config@2.0.0/schema.json",
"changelog": [
"@changesets/cli/changelog",
"@remix-run/changelog-github",
{ "repo": "remix-run/react-router" }
],
"commit": false,
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ node_modules/
/packages/react-router-dom-v5-compat/react-router-dom

.eslintcache
/.env
5 changes: 3 additions & 2 deletions contributors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
- alany411
- alexlbr
- AmRo045
- andreiduca
- avipatel97
- awreese
- aymanemadidi
- aymanemadidi
- bavardage
- bhbs
- BrianT1414
Expand All @@ -33,7 +33,6 @@
- fz6m
- gianlucca
- gijo-varghese
- gijo-varghese
- goldins
- gowthamvbhat
- GraxMonzo
Expand All @@ -47,6 +46,7 @@
- infoxicator
- IsaiStormBlesed
- Isammoc
- jacob-ebey
- JaffParker
- JakubDrozd
- janpaepke
Expand All @@ -68,6 +68,7 @@
- lukerSpringTree
- marc2332
- markivancho
- marvinruder
- maxpou
- mcansh
- MenouerBetty
Expand Down
12 changes: 8 additions & 4 deletions docs/start/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,11 @@ createBrowserRouter(
<Route
path="dashboard"
element={<Dashboard />}
loader={fetch("/api/dashboard.json", {
signal: request.signal,
})}
loader={({ request }) =>
fetch("/api/dashboard.json", {
signal: request.signal,
})
}
/>
<Route element={<AuthLayout />}>
<Route
Expand Down Expand Up @@ -406,7 +408,9 @@ function Issue() {
{/* Await manages the deferred data (promise) */}
<Await resolve={history}>
{/* this calls back when the data is resolved */}
{(history) => <IssueHistory history={history} />}
{(resolvedHistory) => (
<IssueHistory history={resolvedHistory} />
)}
</Await>
</Suspense>

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"@octokit/graphql": "^4.8.0",
"@octokit/plugin-paginate-rest": "^2.17.0",
"@octokit/rest": "^18.12.0",
"@remix-run/changelog-github": "^0.0.5",
"@remix-run/web-fetch": "4.1.3",
"@rollup/plugin-babel": "^5.3.1",
"@rollup/plugin-replace": "^4.0.0",
Expand Down
14 changes: 11 additions & 3 deletions packages/react-router-dom-v5-compat/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
# react-router-dom-v5-compat
# `react-router-dom-v5-compat`

## 6.4.1

### Patch Changes

- Updated dependencies:
- `react-router@6.4.1`
- `react-router-dom@6.4.1`

## 6.4.0

**Updated dependencies**

- react-router-dom@6.4.0
- react-router@6.4.0
- `react-router-dom@6.4.0`
- `react-router@6.4.0`
6 changes: 3 additions & 3 deletions packages/react-router-dom-v5-compat/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-router-dom-v5-compat",
"version": "6.4.0",
"version": "6.4.1",
"description": "Migration path to React Router v6 from v4/5",
"keywords": [
"react",
Expand All @@ -24,12 +24,12 @@
"types": "./dist/index.d.ts",
"dependencies": {
"history": "^5.3.0",
"react-router": "6.4.0"
"react-router": "6.4.1"
},
"peerDependencies": {
"react": ">=16.8",
"react-dom": ">=16.8",
"react-router-dom": "4 || 5"
"react-router-dom": "6.4.1"
},
"files": [
"dist/",
Expand Down
12 changes: 10 additions & 2 deletions packages/react-router-dom/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
# react-router-dom
# `react-router-dom`

## 6.4.1

### Patch Changes

- Updated dependencies:
- `react-router@6.4.1`
- `@remix-run/router@1.0.1`

## 6.4.0

Expand Down Expand Up @@ -27,7 +35,7 @@ Whoa this is a big one! `6.4.0` brings all the data loading and mutation APIs ov

**Updated Dependencies**

- react-router@6.4.0
- `react-router@6.4.0`

[rr-docs]: https://reactrouter.com/
[rr-feature-overview]: https://reactrouter.com/en/6.4.0/start/overview
Expand Down
87 changes: 87 additions & 0 deletions packages/react-router-dom/__tests__/data-browser-router-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2270,6 +2270,93 @@ function testDomRouter(
`);
});

it("handles fetcher ?index params", async () => {
let { container } = render(
<TestDataRouter
window={getWindow("/parent")}
hydrationData={{ loaderData: { parent: null, index: null } }}
>
<Route
path="/parent"
element={<Outlet />}
action={() => "PARENT ACTION"}
loader={() => "PARENT LOADER"}
>
<Route
index
element={<Index />}
action={() => "INDEX ACTION"}
loader={() => "INDEX LOADER"}
/>
</Route>
</TestDataRouter>
);

function Index() {
let fetcher = useFetcher();

return (
<>
<p id="output">{fetcher.data}</p>
<button onClick={() => fetcher.load("/parent")}>
Load parent
</button>
<button onClick={() => fetcher.load("/parent?index")}>
Load index
</button>
<button onClick={() => fetcher.submit({})}>Submit empty</button>
<button
onClick={() =>
fetcher.submit({}, { method: "get", action: "/parent" })
}
>
Submit parent get
</button>
<button
onClick={() =>
fetcher.submit({}, { method: "get", action: "/parent?index" })
}
>
Submit index get
</button>
<button
onClick={() =>
fetcher.submit({}, { method: "post", action: "/parent" })
}
>
Submit parent post
</button>
<button
onClick={() =>
fetcher.submit(
{},
{ method: "post", action: "/parent?index" }
)
}
>
Submit index post
</button>
</>
);
}

async function clickAndAssert(btnText: string, expectedOutput: string) {
fireEvent.click(screen.getByText(btnText));
await waitFor(() => screen.getByText(new RegExp(expectedOutput)));
expect(getHtml(container.querySelector("#output"))).toContain(
expectedOutput
);
}

await clickAndAssert("Load parent", "PARENT LOADER");
await clickAndAssert("Load index", "INDEX LOADER");
await clickAndAssert("Submit empty", "INDEX LOADER");
await clickAndAssert("Submit parent get", "PARENT LOADER");
await clickAndAssert("Submit index get", "INDEX LOADER");
await clickAndAssert("Submit parent post", "PARENT ACTION");
await clickAndAssert("Submit index post", "INDEX ACTION");
});

it("handles fetcher.load errors", async () => {
let { container } = render(
<TestDataRouter
Expand Down
1 change: 0 additions & 1 deletion packages/react-router-dom/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ export type {
ActionFunction,
ActionFunctionArgs,
AwaitProps,
DataMemoryRouterProps,
DataRouteMatch,
DataRouteObject,
Fetcher,
Expand Down
5 changes: 3 additions & 2 deletions packages/react-router-dom/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-router-dom",
"version": "6.4.0",
"version": "6.4.1",
"description": "Declarative routing for React web applications",
"keywords": [
"react",
Expand All @@ -23,7 +23,8 @@
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"dependencies": {
"react-router": "6.4.0"
"@remix-run/router": "1.0.1",
"react-router": "6.4.1"
},
"devDependencies": {
"react": "^18.2.0",
Expand Down
11 changes: 9 additions & 2 deletions packages/react-router-native/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# react-router-native
# `react-router-native`

## 6.4.1

### Patch Changes

- Updated dependencies:
- `react-router@6.4.1`

## 6.4.0

Expand All @@ -9,4 +16,4 @@

**Updated dependencies**

- react-router@6.4.0
- `react-router@6.4.0`
1 change: 0 additions & 1 deletion packages/react-router-native/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export type {
ActionFunction,
ActionFunctionArgs,
AwaitProps,
DataMemoryRouterProps,
DataRouteMatch,
DataRouteObject,
Fetcher,
Expand Down
4 changes: 2 additions & 2 deletions packages/react-router-native/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-router-native",
"version": "6.4.0",
"version": "6.4.1",
"description": "Declarative routing for React Native applications",
"keywords": [
"react",
Expand All @@ -22,7 +22,7 @@
"types": "./dist/index.d.ts",
"dependencies": {
"@ungap/url-search-params": "^0.1.4",
"react-router": "6.4.0"
"react-router": "6.4.1"
},
"devDependencies": {
"react": "^18.2.0",
Expand Down
12 changes: 10 additions & 2 deletions packages/react-router/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
# react-router
# `react-router`

## 6.4.1

### Patch Changes

- Preserve state from `initialEntries` ([#9288](https://github.com/remix-run/react-router/pull/9288))
- Updated dependencies:
- `@remix-run/router@1.0.1`

## 6.4.0

Expand All @@ -19,7 +27,7 @@ Whoa this is a big one! `6.4.0` brings all the data loading and mutation APIs ov

**Updated Dependencies**

- @remix-run/router@1.0.0
- `@remix-run/router@1.0.0`

[rr-docs]: https://reactrouter.com/
[rr-feature-overview]: https://reactrouter.com/en/6.4.0/start/overview
Expand Down
23 changes: 23 additions & 0 deletions packages/react-router/__tests__/useLocation-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,27 @@ describe("useLocation", () => {
</div>
`);
});

it("preserves state from initialEntries", () => {
let renderer: TestRenderer.ReactTestRenderer;
TestRenderer.act(() => {
renderer = TestRenderer.create(
<MemoryRouter
initialEntries={[
{ pathname: "/example", state: { my: "state" }, key: "my-key" },
]}
>
<Routes>
<Route path={"/example"} element={<ShowLocation />} />
</Routes>
</MemoryRouter>
);
});

expect(renderer.toJSON()).toMatchInlineSnapshot(`
<pre>
{"pathname":"/example","search":"","hash":"","state":{"my":"state"},"key":"my-key"}
</pre>
`);
});
});
2 changes: 0 additions & 2 deletions packages/react-router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import {
} from "@remix-run/router";

import type {
DataMemoryRouterProps,
AwaitProps,
MemoryRouterProps,
NavigateProps,
Expand Down Expand Up @@ -113,7 +112,6 @@ export type {
ActionFunction,
ActionFunctionArgs,
AwaitProps,
DataMemoryRouterProps,
DataRouteMatch,
DataRouteObject,
Fetcher,
Expand Down
10 changes: 0 additions & 10 deletions packages/react-router/lib/components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,6 @@ export function RouterProvider({
);
}

export interface DataMemoryRouterProps {
basename?: string;
children?: React.ReactNode;
initialEntries?: InitialEntry[];
initialIndex?: number;
hydrationData?: HydrationState;
fallbackElement?: React.ReactNode;
routes?: RouteObject[];
}

export interface MemoryRouterProps {
basename?: string;
children?: React.ReactNode;
Expand Down

0 comments on commit f3009f5

Please sign in to comment.