-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wrap resource route raw object return in json for v2 back compat
- Loading branch information
1 parent
75321d3
commit 56e0a3f
Showing
5 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@remix-run/server-runtime": patch | ||
--- | ||
|
||
Automatically wrap resource route naked object returns in `json()` for back-compat in v2 (and log deprecation warning) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export function resourceRouteJsonWarning( | ||
type: "loader" | "action", | ||
routeId: string | ||
) { | ||
return ( | ||
"⚠️ REMIX FUTURE CHANGE: Resource routes will no longer be able to " + | ||
"return raw JavaScript objects in v3 when Single Fetch becomes the default. " + | ||
"You can prepare for this change at your convenience by wrapping the data " + | ||
`returned from your \`${type}\` function in the \`${routeId}\` route with ` + | ||
"`json()`. For instructions on making this change see " + | ||
"https://remix.run/docs/en/v2.9.2/guides/single-fetch#resource-routes" | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters