@remix-run/router 1.6.3 → 1.7.0-pre.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,59 @@
1
1
  # `@remix-run/router`
2
2
 
3
+ ## 1.7.0-pre.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Add support for `application/json` and `text/plain` encodings for `router.navigate`/`router.fetch` submissions. To leverage these encodings, pass your data in a `body` parameter and specify the desired `formEncType`: ([#10413](https://github.com/remix-run/react-router/pull/10413))
8
+
9
+ ```js
10
+ // By default, the encoding is "application/x-www-form-urlencoded"
11
+ router.navigate("/", {
12
+ formMethod: "post",
13
+ body: { key: "value" },
14
+ });
15
+
16
+ async function action({ request }) {
17
+ let formData = await request.formData();
18
+ // formData => FormData instance with entry [key=value]
19
+ }
20
+ ```
21
+
22
+ ```js
23
+ // Pass `formEncType` to opt-into a different encoding
24
+ router.navigate("/", {
25
+ formMethod: "post",
26
+ formEncType: "application/json",
27
+ body: { key: "value" },
28
+ });
29
+
30
+ async function action({ request }) {
31
+ let json = await request.json();
32
+ // json => { key: "value" }
33
+ }
34
+ ```
35
+
36
+ ```js
37
+ router.navigate("/", {
38
+ formMethod: "post",
39
+ formEncType: "text/plain",
40
+ body: "Text submission",
41
+ });
42
+
43
+ async function action({ request }) {
44
+ let text = await request.text();
45
+ // text => "Text submission"
46
+ }
47
+ ```
48
+
49
+ ### Patch Changes
50
+
51
+ - Call `window.history.pushState/replaceState` before updating React Router state (instead of after) so that `window.location` matches `useLocation` during synchronous React 17 rendering. However, generally apps should not be relying on `window.location` and should always reference `useLocation` when possible, as `window.location` will not be in sync 100% of the time (due to `popstate` events, concurrent mode, etc.) ([#10211](https://github.com/remix-run/react-router/pull/10211))
52
+ - Avoid calling `shouldRevalidate` for fetchers that have not yet completed a data load ([#10623](https://github.com/remix-run/react-router/pull/10623))
53
+ - Strip `basename` from the `location` provided to `<ScrollRestoration getKey>` to match the `useLocation` behavior ([#10550](https://github.com/remix-run/react-router/pull/10550))
54
+ - Fix `unstable_useBlocker` key issues in `StrictMode` ([#10573](https://github.com/remix-run/react-router/pull/10573))
55
+ - Upgrade `typescript` to 5.1 ([#10581](https://github.com/remix-run/react-router/pull/10581))
56
+
3
57
  ## 1.6.3
4
58
 
5
59
  ### Patch Changes
package/dist/history.d.ts CHANGED
@@ -84,7 +84,7 @@ export interface Listener {
84
84
  * `history.push` or `history.replace`. May be either a URL or the pieces of a
85
85
  * URL path.
86
86
  */
87
- export declare type To = string | Partial<Path>;
87
+ export type To = string | Partial<Path>;
88
88
  /**
89
89
  * A history is an interface to the navigation stack. The history serves as the
90
90
  * source of truth for the current location, as well as provides a set of
@@ -161,8 +161,8 @@ export interface History {
161
161
  * A user-supplied object that describes a location. Used when providing
162
162
  * entries to `createMemoryHistory` via its `initialEntries` option.
163
163
  */
164
- export declare type InitialEntry = string | Partial<Location>;
165
- export declare type MemoryHistoryOptions = {
164
+ export type InitialEntry = string | Partial<Location>;
165
+ export type MemoryHistoryOptions = {
166
166
  initialEntries?: InitialEntry[];
167
167
  initialIndex?: number;
168
168
  v5Compat?: boolean;
@@ -192,7 +192,7 @@ export declare function createMemoryHistory(options?: MemoryHistoryOptions): Mem
192
192
  */
193
193
  export interface BrowserHistory extends UrlHistory {
194
194
  }
195
- export declare type BrowserHistoryOptions = UrlHistoryOptions;
195
+ export type BrowserHistoryOptions = UrlHistoryOptions;
196
196
  /**
197
197
  * Browser history stores the location in regular URLs. This is the standard for
198
198
  * most web apps, but it requires some configuration on the server to ensure you
@@ -214,7 +214,7 @@ export declare function createBrowserHistory(options?: BrowserHistoryOptions): B
214
214
  */
215
215
  export interface HashHistory extends UrlHistory {
216
216
  }
217
- export declare type HashHistoryOptions = UrlHistoryOptions;
217
+ export type HashHistoryOptions = UrlHistoryOptions;
218
218
  /**
219
219
  * Hash history stores the location in window.location.hash. This makes it ideal
220
220
  * for situations where you don't want to send the location to the server for
@@ -244,7 +244,7 @@ export declare function createPath({ pathname, search, hash, }: Partial<Path>):
244
244
  export declare function parsePath(path: string): Partial<Path>;
245
245
  export interface UrlHistory extends History {
246
246
  }
247
- export declare type UrlHistoryOptions = {
247
+ export type UrlHistoryOptions = {
248
248
  window?: Window;
249
249
  v5Compat?: boolean;
250
250
  };