You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: DEVELOPMENT.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,18 +38,19 @@ You may need to make changes to a pre-release prior to publishing a final stable
38
38
### Publishing the stable release
39
39
40
40
- Exit Changesets pre-release mode: `yarn changeset pre exit`.
41
-
- Commit the deleted pre-release file along with any unpublished changesets, and push the the `release-*` branch to GitHub.
41
+
- Commit the edited pre-release file along with any unpublished changesets, and push the the `release-*` branch to GitHub.
42
42
- Wait for the release workflow to finish. The Changesets action in the workflow will open a PR that will increment all versions and generate the changelogs for the stable release.
43
43
- Review the updated `CHANGELOG` files and make any adjustments necessary.
44
44
- We should remove the changelogs for all pre-releases ahead of publishing the stable version.
45
45
-[TODO: We should automate this]
46
+
- Prepare the github release notes
47
+
- Copy the relevant changelog entries from all packages into the Release Notes and adjust accordingly, matching the format used by prior releases
46
48
- Merge the PR into the `release-*` branch.
47
49
- Once the PR is merged, the release workflow will publish the updated packages to npm.
48
50
- Once the release is published:
49
51
- merge the `release-*` branch into `main` and push it up to GitHub
50
52
- merge the `release-*` branch into `dev` and push it up to GitHub
51
53
- Convert the `[email protected]` tag to a Release on Github with the name `v6.x.y`
52
-
- Copy the relevant changelog entries from all packages into the Release Notes and adjust accordingly, matching the format used by prior releases
Copy file name to clipboardExpand all lines: docs/routers/create-static-handler.md
+42-3Lines changed: 42 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -82,13 +82,52 @@ interface StaticHandler {
82
82
83
83
These are the same `routes`/`basename` you would pass to [`createBrowserRouter`][createbrowserrouter]
84
84
85
-
## `handler.query(request)`
85
+
## `handler.query(request, opts)`
86
86
87
87
The `handler.query()` method takes in a Fetch request, performs route matching, and executes all relevant route action/loader methods depending on the request. The return `context` value contains all of the information required to render the HTML document for the request (route-level `actionData`, `loaderData`, `errors`, etc.). If any of the matched routes return or throw a redirect response, then `query()` will return that redirect in the form of Fetch `Response`.
88
88
89
-
##`handler.queryRoute(request, routeId?)`
89
+
### `opts.requestContext`
90
90
91
-
The `handler.queryRoute` is a more-targeted version that queries a singular route and runs it's loader or action based on the request. You can specify a specific `routeId` or let it match the appropriate route automatically based on the request. The return value is the values returned from the loader or action, which is usually a `Response` object.
91
+
If you need to pass information from your server into Remix actions/loaders, you can do so with `opts.requestContext` and it will show up in your actions/loaders in the context parameter.
92
+
93
+
```ts
94
+
const routes = [{
95
+
path: '/',
96
+
loader({ request, context }) {
97
+
// Access `context.dataFormExpressMiddleware` here
98
+
},
99
+
}];
100
+
101
+
exportasyncfunction render(req:express.Request) {
102
+
let { query, dataRoutes } =createStaticHandler(routes);
103
+
let remixRequest =createFetchRequest(request);
104
+
let staticHandlerContext =awaitquery(remixRequest, {
105
+
// Pass data from the express layer to the remix layer here
106
+
requestContext: {
107
+
dataFromExpressMiddleware: req.something
108
+
}
109
+
});
110
+
...
111
+
}
112
+
```
113
+
114
+
## `handler.queryRoute(request, opts)`
115
+
116
+
The `handler.queryRoute` is a more-targeted version that queries a singular route and runs it's loader or action based on the request. By default, it will match the target route based on the request URL. The return value is the values returned from the loader or action, which is usually a `Response` object.
117
+
118
+
### `opts.routeId`
119
+
120
+
If you need to call a specific route action/loader that doesn't exactly correspond to the URL (for example, a parent route loader), you can specify a `routeId`:
If you need to pass information from your server into Remix actions/loaders, you can do so with `opts.requestContext` and it will show up in your actions/loaders in the context parameter. See the example in the `query()` section above.
0 commit comments