Releases: redwoodjs/redwood
v0.28.0
tl;dr
The Redwood Community shipped some code in this release. A lot of code. Many amazing new features. And you're going to like what they added π
This release contains recommended code modifications, which are required to use new features such as the Logger. See the "How to Upgrade" section for more information.
v0.28 Highlights π
There are so many amazing contributors to thank for this release. And for major new features like the Logger, the new Router <Set />
, and Router a11y, there were months of discussions, iterations, and collaboration happening behind the scenes of every PR. To all of you both seen and unseen, thank you! And for everyone else who gets to benefit from all the goodness jam-packed into v0.28, we can't wait to see what you build.
π§ Router <Set wrap={}>
You can now group Routes into sets using the Set
component. Set
allows you to wrap a set of Routes in another component or array of componentsβusually a Context, a Layout, or both.
- Learn how to use it via the Router Doc
- See it in action in the updated sections of the Tutorial, starting with Layouts
- Have suggestions, feedback, or "thanks" to give? Check out this Forum Post about the new feature.
πͺ£ Logger
Introducing API logging done the RedwoodWay: an opinionated logger with sensible, practical defaults that grants you visibility into the applications while you're developing and after you have deployed. Under the hood, the Logger is built on pino with its rich features, ecosystem and community.
- There's a whole lot you can do with the new Logger. Check out the Logger Doc to get started.
β οΈ If you are upgrading, you will need to manually add the Logger to your project. See the "Manual Code Modifications" section below.
π Accessibility (aka a11y)
This release is an important, foundational step for Redwood a11y: all your pages will automatically be announced to screen-reader users. You can customize the announcement with the RouteAnnouncement
component (@redwoodjs/router
). Keep a lookout for even more in future releases β focus management, skip links, and tooling (via yarn rw setup a11y
).
- Check out the new Accessibility Doc
- Stay in the loop and provide feedback via this Forum Post
βοΈ Storybook v6: Now Configurable!
Redwood has upgraded to Storybook v6, which you can configure and customize to your heart's delight via storybook.config.js
and storybook.preview.js
.
- Check out the new Storybook Doc
π ESBuild: API + Web (experimental)
Level up build performance (optionally) with ESBuild. It's experimental at the moment, which means we need your help trying it out and letting us know how it worked! Should we make the full switch to ESBuild?
- Check out this Forum Post to learn more and let us know how you like it
Changed
- Auth: Pass event and context into getCurrentUser #1908 by @brentjanderson
- Auth: Improve auth cli filesystem calls #2007 by @renansoares
- Auth: Azure Active Directory Auth β Adding try-catch block on callback to capture empty key #2010 by @jeliasson
- Auth: return signup() output from auth client #1992 by @jvanbaarsen
β οΈ signUp
fromuseAuth
returns a promise that will now resolve with the return value of the underlying auth client's sign-up method. Previously that promise always resolved withundefined
.
- Internal: Refactor: Converted Prisma.ts to js #1958 by @saideepesh000
- Internal: Update error message in tasks/publish-local to point to tasks/run-loc... #2004 by @webstackdev
- Internal: Update all contributors as of v0.27+ #2045 by @thedavidprice
- API: Make per-request-context rely on lazy initialization #2046 by @peterp
- CLI: Set cwd to project's base path when running yarn rw upgrade #2081 by @qooqu
- Generators: Updates checkbox width CSS #2093 by @cannikin
- Storybook: Bump Storybook to 6.1 #2054 by @corbt π
- can now define a custom Storybook preview file in
web/config/storybook.preview.js
- can now define a custom Storybook preview file in
- Prisma: Upgrade to Prisma 2.19.0 (Prisma Migrate GA) #2021 by @thedavidprice
- v2.19.0 Release Notes
- Prisma Migrate now GA π
- added support for
prisma db pull
, which was added in 2.18 and will replaceintrospect
in the future
- v2.19.0 Release Notes
Added
- Router: #1898 by @Tobbe π
- Router: Make useParams usable in layouts in #2043 by @Tobbe π
- Logger: Implement Redwood API side Logger #1937 #2090 by @dthyresson π
- a11y: Steps towards a11y for Redwood Router #1817 by @jtoar π
- also adds scroll to top on new page navigation
- a11y: Add a11y configuration for eslint #1849 #2087 by @jtoar π
- Build: Add experimental ESBuild for api side #1948 by @peterp π
- Build: Use esbuild-loader for web side. #2049 by @peterp π
- API: Add makeExecSchema options #1964 by @peterp
β οΈ - [DEPRECATION Warning]
makeMergedSchema
optionschemaDirective
will be deprecated. UseschemaOptions
instead.
- [DEPRECATION Warning]
- TS: TypeScript support for CLI function-generator #1854 by @realStandal
- CI: Add CodeQL Analysis GitHub Action #1951 by @thedavidprice
- Prisma: Add Prisma 'format' to command array requiring schema #2061 by @thedavidprice
Fixes
- Cells: withCellHOC: Fix TS error #1967 by @Tobbe
- Auth: Fix issue with verify email redirect using Auth0 #1990 by @o0charlie0o
- Auth: fix Router error when useAuth isn't passed #2038 by @Tobbe
- Docs: remove (coming soon) #1998 by @guledali
- Docs: Simple typo fixes in README #2041 by @bdurette
- Docs: Replaces logger docs with link to www site docs #2094 by @dthyresson
- Internal Fix yarn install errors: upgrade gotrue-js to v0.9.29 #2011 by @thedavidprice
- Internal: Fixed path on windows to allow for pages under subdirectories #2022 by @cjreimer
- Storybook: Fix grabbing a user's storybook config #2002 by @jtoar
- Lint: globalContext.tsx: Fix lint warning #2000 by @Tobbe
- Lint: Fix lint breaking when deleting a side #2017 by @Magicjuju
- Lint: Fix router lint issue | Bump and pin @types/react to 17.0.3 #2058 by @dac09
- Testing: fix: mock window.scrollTo to stop jest's consoling #2044 by @jtoar
- Logger: Fixes case when File Logging didn't get set with the correct logger options #2047 by @dthyresson
- Logger: Fix Logger Readme destination param in transport examples #2055 by @dthyresson
- DevServer: fix(html-mismatch) β Fixes warning in browser console #2056 by @dac09
- Generator: Pick a field other than a foreign key when creating update test #2059 by @cannikin
- Forms: Fixes formatDateTime helper when field is optional and value is empty #2072 by @cannikin
- Filesystem: Fix glob matching to support subdirectories #2079 by @peterp
- Router: only render one page #2080 by @Tobbe
- a11y: Fix invalid html in route announcer test #2089 by @jtoar
- TS: Fix typeDefs for schema options #2096 @peterp
Breaking β οΈ
Surprise! Nothing to see here. If you've been keeping up with upgrades for a while, you've earned yourself a treat π¦
How to upgrade to Redwood v0.28 from v0.27
π IMPORTANT: Skipping versions when upgrading is not recommended and will likely cause problems. Do read through all Release Notes between your current version and this latest version. Each minor release will likely require you to implement breaking change fixes and apply manual code modifications.
Manual Code Modifications
Logger (opt-in)
To use the new Redwood Logger, you will need to make the following changes.
1. Optional Env Var
We recommend adding this commented code to your env.defaults
so you'll have it as a reminder when you need it!
- reference env.defaults
// env.defaults
# Option to override the current environment's default api-side log level
# See: https://redwoodjs.com/docs/logger for level options:
# trace | info | debug | warn | error | silent
# LOG_LEVEL=debug
2. DB Imports
Make the following changes to add imports:
- reference db.[ts|js]
// api/src/lib/db.[ts|js]
import { PrismaClient } from '@prisma/client'
-export const db = new PrismaClient()
+import { emitLogLevels, handlePrismaLogging } from '@redwoodjs/api/logger'
+
+import { logger } from './logger'
+
+/*
+ * Instance of the Prisma Client
+ */
+export const db = new PrismaClient({
+ log: emitLogLevels(['info', 'warn', 'error']),
+})
+
+handlePrismaLogging({
+ db,
+ logger,
+ logLevels: ['info', 'warn', 'error'],
+})
Create a new Logger file
Create a new file api/src/lib/logger.[ts|js]
. (Note: choose .js or .ts based on your project language target.)
- reference logger.[ts|js]
// api/src/lib/logger.[ts|js]
import { createLogger } from '@redwoodjs/api/logger'
/**
* Creates a logger with RedwoodLoggerOptions
*
* These extend and overrid...
v0.27.1
This release contains many important internal changes that improve security, TypeScript support, framework development CI/CD, and upgrades necessary to prepare for a future v1 release candidate (e.g. upgrading to React v17).
Thank you to all the amazing contributors who are keeping the PRs rolling! Redwood is amazing because of you π
β οΈ This release contains Breaking Changes and requires code modifications. See the "Breaking" and "How to Upgrade" sections for more information.
Changed
- βΉοΈ Bump CRWA Node.js Engine requirement from 12 to 14 (#1946) 5dbb9e0 @thedavidprice
- Replaces Flash with react-hot-toast (#1856) 4a899b5 @cannikin
- see new Toast Notifications Doc
β οΈ Deprecation Warning: see "Breaking" section below
- Router Docs - Remove idea of sharing router outside of Redwood (#1900) 624b0d5 @andrew-hwahin
- Port test-tutorial script to JS (#1896) df8d0c2 @dac09
β οΈ Upgrade React to v17. (#1705) f586198 @peterpβ οΈ Upgrade to Prisma v2.18.0 (skipping v2.17.0) (#1851) 9f62208 @thedavidprice- Contains changes that may be "Breaking" for some projects. See βBreakingβ section below.
Added
- Add rw cli tests to e2e (#1932) b0de879 @dac09
- Allow prerendering NotFoundPage as 404.html (#1891) 1ebcee6 @dac09
- Move ts-to-js from 'rwt' to 'rw'. (#1943) 57a14a0 @peterp
- Switch create-redwood-app template to TypeScript (#1810) 91cef20 @peterp
- Make storybook configurable in a redwood app (#1828) 751d342 @jtoar
- Add per request global context (#1789) 148aa46 @peterp
- Add Cypress workflow (#1895) 9f87e1e @peterp
- Add Cypress Step7 Test (#1882) bcc8dd2 @wafuwafu13
- Run a diagnostic check when prerender fails #1962 @dac09
Fixes
- i18n Setup : Simpler configuration + examples (#1847) 42ec5eb @simoncrypta
- Fix/rwt link on canary (#1939) 3843722 @dac09
- Adds resolution to template, to prevent module duplication in web/node_modules (#1933) a86fea3 @dac09
- Update service generator to use Prisma namespace (#1853) 437eefb @o0charlie0o
- Fixes 1902 to rwt link when path has spaces/parens (#1903) 0f4126c @dthyresson
- Fixes marshalling datetimes in and out of forms (#1906) f39a8bb @cannikin
- Rename scenario.* to scenarios.* (#1885) 74ca3bd @jvanbaarsen
- Lazily create AsyncLocalStorage when needed #1994 @Tobbe
Breaking β οΈ
Upgrading React and adding a package resolution
As of this version, Redwood is using React v17.0.1. However, other dependencies, e.g. Storybook, use a different version of React. This results in packages being duplicated and hoisted into web/node_modules
, which breaks unexpected things.
Projects need to bump their version of React. Additionally, to avoid duplication and hoisting, the solution is to add a package resolution. See the βHow to upgradeβ¦β section below.
Bumping Node.js Engine to v14
Technically this is not (yet) a breaking change. We are bumping Redwoodβs Node.js requirement to Node.js v14 (from v12) and strongly encourage you to make the change now in your project. See βHow to upgradeβ¦β section below.
Replace Flash with React Hot Toast [deprecation warning]
This release replaces our custom Flash stuff with react-hot-toast
and updates the scaffold generators to generate with the new interface. Importing Flash will give a deprecation warning. Flash will be fully deprecated in Redwood v1 release.
Migration to react-hot-toast
is not required yet unless you are using dismissMessage()
and cycleMessage()
, which will now be a noop and you'll just see the deprecation notice.
See more information and a guide here for switching from Flash to Toaster.
Prisma Changes that may affect some projects
Prisma Type Mapping
Type mapping from Prisma schema to the database for Float
has changed from Decimal
to Double
in MySQL and PostgreSQL. Check out this video guide, which covers how to upgrade and address the remapping of Float.
Breaking changes due to strict type diffing and native types
Prisma no longer allows the loose mapping of Prisma scalar types to database column types without the specific notation. For more info, see Prisma v2.17.0 Release Notes
How to upgrade to Redwood v0.27 from v0.26
π IMPORTANT: Skipping versions when upgrading is not recommended and will likely cause problems. Do read through all Release Notes between your current version and this latest version. Each minor release will likely require you to implement breaking change fixes and apply manual code modifications.
Manual Code Modifications
Step 1: React upgrade and resolutions
In your root package.json
, add the following resolutions (see also this reference code):
+ "resolutions": {
+ "react-dom": "17.0.1",
+ "react": "17.0.1"
+ }
Depending on what Redwood version your project started on, there might be other lower priority changes to
./package.json
. Now might be a good time to inspect the current create-redwood-app package.json template code here and make other updates if needed.
And in your web/package.json
, make sure react
and react-dom
in your dependencies are at the correct version (see also this reference code):
- "react-dom": "^16.13.1",
- "react": "^16.13.1",
+ "react": "17.0.1",
+ "react-dom": "17.0.1",
Then run:
yarn install
π Note: When running
yarn install
during and after the upgrade you will see several warnings that are expected and safe to ignore:
[1/5] π Validating package.json...
[2/5] π Resolving packages...
warning Resolution field "[email protected]" is incompatible with requested version "react@^16.8.3"
warning Resolution field "[email protected]" is incompatible with requested version "react@^16.8.3"
warning Resolution field "[email protected]" is incompatible with requested version "react-dom@^16.8.3"
warning Resolution field "[email protected]" is incompatible with requested version "react@^16.8.3"
warning Resolution field "[email protected]" is incompatible with requested version "react-dom@^16.8.3"
warning Resolution field "[email protected]" is incompatible with requested version "react@^16"
Step 2: Running your app on Node.js v14.x
In your root package.json
, make the following change (see also this reference code):
+ βenginesβ: {
- "node": ">=12β,
+ "node": ">=14",
+ }
Check if the file .nvmrc
exists in your project root. If not, create it. Then add the following, which is a configuration option to use the lates LTS version of Node.js, which is currently v14.x. (see also this reference file):
lts/*
If you are deploying on Netlify or Vercel, the .nvmrc
will automatically configure the build environment to use Node.js v14.x. There is an additional setting on Vercel you may change in Settings/General/βNode.js Versionβ. However, the .nvmrc
file will take precedence.
Upgrade Packages
π IMPORTANT: In this version, upgrading packages is a two-step process. Please complete both steps to ensure youβve resolved any possible issues with React package duplication.
Step 1
Run the following command within your App's directory:
yarn rw upgrade
Step 2
Once the upgrade is complete, inspect the Web workspace for web/node_modules
. If this directory is present (it most likely will be), remove it:
rm -rf web/node_modules
This command works for Mac and Linux. For Windows, use the applicable shell command to delete the directory and its contents.
Lastly, run a force install:
yarn --force
Confirm there are no duplicate react
, react-dom
, or core-js
packages in web/node_modules
(which might not exist at all). If you have questions about this process or need help, see this forum topic.
Need other help or having trouble upgrading packages? See this forum topic for manual upgrade instructions and general upgrade help.
v0.26.2
This release introduces the new Prerender feature, which is the culmination of months of work by many individuals across the community. Prerender in Redwood is opt-in (simply add a prop to a Route!) with built-in support that "just works" β it's fully compatible with other Redwood features like Cells. This is the first new feature from the Redwood at Scale initiative, which will bring many future improvements to application performance.
We think you're going to like it π
β οΈ This release contains Breaking Changes and requires code modifications. See the "Breaking" and "How to Upgrade" sections for more information.
v0.26.0 Highlights π
β‘οΈ Redwood Prerender
Both @dac09 and @peterp carried this one to the finish line. Well done, you two!
Although prerendering is as easy as adding a prerender
prop to a Route, there's more you can do and need to know:
- Redwood Prerender Doc: how to, helpers, and specific considerations
- For reference, you'll want to understand how Redwood is now automatically handling
App.js
mounting to the DOM. And for complex cases, you might need to customizeindex.js
. Take a look at the Custom Index Doc - For a full walk-through of Redwood Prerender, including discussion and Q&A, watch this YouTube Video from the most recent Meetup
Ready to get started?
All new Redwood projects are ready for prerendering once they're installed! 'Cause that's the Redwood way π²
If you're upgrading your project, start with the "Manual Code Modifications" section below before you set up prerender on your Routes.
π Nhost Auth Provider
The fine folks at Nhost have added a Redwood Auth provider. Check it out!
- Redwood Nhost Auth Doc
- Learn more about Nhost Auth
Changed
- Docs: link to the roadmap in readme #996 by @jtoar
- Router:
<Route redirect="">
#1704 by @Tobbe - Router: Generate globals for routes #1744 by @Tobbe
- Seed: Use createMany in Seed database example #1776 by @simoncrypta
- Prisma: Prisma: use new 'prisma' package to replace '@prisma/cli' #1800 by @thedavidprice
- Auth: Ethereum auth update to v0.2.1 #1807 by @pi0neerpat
- Internal: Update typescript lint rule for no-unused-vars #1808 by @jangxyz
- Internal: Make ESLint configuration aware of "env." #1827 by @peterp
- Internal: Improve/template and auth setup tests #1834 by @dac09
- Internal: Editorconfig and VSC recommendation changes #1841 by @Krisztiaan
- Internal: Remove bundlesize dependency #1844 by @Krisztiaan
- Docs: Add Gravatar to the list of Tom's accomplishments #1813 by @bl-ue
Added
- Prerender: Render landing/marketing/static pages + Private page whileLoading #1641 by @dac09 π
- Prerender: image support #1721 by @dac09
- Prerender: Better messages when no routes marked with prerender #1821 by @dac09
- Prerender: Hide entry.js | Add setup command to restore #1842 by @dac09
β οΈ - Prerender: Changes for prerender release #1855 by @dac09
- Auth: Nhost Auth 1.0 provider #1725 by @nunopato π
- CSS: Minify CSS in production builds #1697 by @dac09
- Internal: Add Cypress Step6 Test #1780 by @wafuwafu13
- Internal: New contributor workflow #1792 by @dac09
- Internal: Add curly rule for blocks #1836 by @Krisztiaan
- Docs: Docs: Update contributor workflow to yarn rwt link #1803 by @jtoar
- Docs: Update CONTRIBUTING.md
rwt link
docs #1852 by @dac09 - TS: Add types to Flash, clean up some logic #1824 by @Krisztiaan
Fixes
- Prerender: Fixes to crwa template for prerender #1819 by @dac09
- Prerender: Adds types for pageLoadingContext | Fix for pageLoader during prerender #1832 by @dac09
- Prerender: replace instances of web/src/index.js with web/src/App.js #1857 by @thedavidprice
- Prisma: use new 'prisma' package to replace '@prisma/cli' #1800 by @thedavidprice
- CLI: Passthrough error codes on cli failures #1791 by @dac09
- CLI: Remove backticks #1826 by @adriatic
- CLI: Fix
dataMigrate
command import error via babel register #1845 by @dac09 - CLI: fix
rw test
command when run from dir other than root and upgrade execa #1846 by @thedavidprice - Storybook: Don't open storybook when --open=false is given #1795 by @jvanbaarsen
- Template: Lint the create-redwood-app template #1822 by @peterp
- TS: Fix Router TS types #1823 by @Tobbe
- Internal: E2E if path to project given, use the installed packages #1837 by @thedavidprice
- Internal: webpack config use || instead of ?? #1881 by @Tobbe
- Generators: Fixes generating scenarios for relations where the field name is different than the relation name #1848 by @cannikin
- Tests: Run Teardown after each test #1818 by @jvanbaarsen
Breaking β οΈ
To offer built-in Prerender support, Redwood now handles mounting the React <App />
to the DOM internally. This enhancement required breaking changes to the existing web/src/index.js
.
- in
web/src/index.js
, the React root element is now a component. References to the browser window, e.g.document.
will throw an error web/src/index.js
has been renamed toweb/src/App.js
To learn more about how Redwood is automatically handling mounting, see this Custom Web Index doc. For some applications with specific index.js
requirements, this document provides customization instructions.
How to upgrade Redwood to the latest v0.26
π IMPORTANT: Skipping versions when upgrading is not recommended and will likely cause problems. Do read through all Release Notes between your current version and this latest version. Each minor release will likely require you to implement breaking change fixes and apply manual code modifications.
Manual Code Modifications
1. Rename web/src/index.js
to web/src/App.js
2. In web/src/App.js
, convert the React root element to a component named App
Any references to the browser window need to either be removed or wrapped in a conditional like isBrowser
(see step 4 for more about the Prerender utils Redwood provides to make checking for these cases easier). For existing Redwood projects, this means at a minimum you'll need to remove ReactDOM.render(...document.getElementbyID()...
-import ReactDOM from 'react-dom'
import { FatalErrorBoundary } from '@redwoodjs/web'
import { RedwoodApolloProvider } from '@redwoodjs/web/apollo'
import FatalErrorPage from 'src/pages/FatalErrorPage'
import Routes from 'src/Routes'
import './index.css'
-ReactDOM.render(
+ const App = () => (
<FatalErrorBoundary page={FatalErrorPage}>
<RedwoodApolloProvider>
<Routes />
</RedwoodApolloProvider>
</FatalErrorBoundary>,
- document.getElementById('redwood-app')
)
+ export default App
Depending on other custom implementations to your projects App.js
, you may need to make additional changes or, in some cases, even create a custom web/src/index.js
to handle Reacting mounting. If so, see the Custom Web Index doc
3. Update web/src/index.html
to support prerender
This lets Redwood know where to place your pre-rendered HTML.
...
<body>
<div id="redwood-app">
+ <%= prerenderPlaceholder %>
</div>
...
4. Special Prerender Considerations
If you're ready to take Prerender for a spin, now is the time to look through the Redwood Prerender Doc, especially the section "Prerender Utils".
Sometimes you'll need granular control over what gets prerendered. For example, if you're using Netlify Identity, you can only initialize it on the browser. You'll need to use the isBrowser
helper in your web/src/App.js
:
+ import { isBrowser } from '@redwoodjs/prerender/browserUtils'
...
+ if (isBrowser) {
netlifyIdentity.init()
+ }
Don't worry, we don't expect you to know how to identify every case like this. You can check using the following debugging flow:
- First run
yarn rw build web
. If elements can't run on Node.js, they'll throw errors here, which will show you what needs specific handling. - Once you can build successfully, then run
yarn rw prerender --dry-run
. You may get a lot of warnings, which is fine. Keep a lookout especially forerror
, which indicates other elements that require special handling.
Upgrade Packages
Run the following command within your App's directory:
yarn rw upgrade
Need help or having trouble upgrading packages? See this forum topic for manual upgrade instructions and general upgrade help.
v0.25.1
v0.25.0
You're about to look through these notes and π€―. Go ahead and take a moment. We'll wait...
OK, now that you're back, admittedly there are a lot of changes in this release (we're looking at you, Prisma π). But while you see words on a screen including lots of bullet points, what we see is an incredible community of contributors that hammered out 40 merged PRs in just 9 days. Yes, π€― indeed. Also π. Lots of ππ
To each and every one of you who contributed, you are simply amazing! And to each and every one of you about to upgrade so you can continue building something amazing, we can't wait to see what you do with Redwood!
β οΈ This release contains Breaking Changes and requires code modifications. See the "Breaking" and "How to Upgrade" sections for more information.
v0.25.0 Highlights π
So. Much. Prisma.
This release upgrades to the new, and greatly improved, Prisma Migrate, which includes new workflows for DB management and a β¨ new Prisma CLI. It's fancy. But it changes a lot of things. Like, a whole lot. Don't worry. The hard integration work is done for you!
- This upgrade resolves the Notorious EPIPE serverless API connection error π (What, you don't know about the EPIPE bug? Lucky you.)
- π Get started with the new
yarn redwood prisma
commands via our CLI Doc- Also it's going to be very helpful to learn about new Prisma Migration Flows using the CLI
- Bummer π’: we can no longer use two DBs, e.g.
provider = ["sqlite", "postgresql"]
inschema.prisma
(aka the Dynamic Provider). See "Breaking" and "How to Upgrade" sections below. - Have a Production DB? You'll need to, um, migrate it to the new Prisma Migrate! Check out this handy guide covering both local dev and production DB upgrade steps. π
Scaffold Generators now Support Prisma @relations
With some exceptions about syntax (hint: no @@id
), you can now use Redwood's Scaffold generators with both one-to-many and many-to-many Prisma Schema relations.
- Here's the Redwood Doc about Schema Relations
- And the Prisma Relations Doc
Changed
- Generators: Scaffolded many-to-many relationship #1758 by @cannikin π
- Generators: Remove warning if you scaffold a model with a relation #1757 by @cannikin
- CLI: restructure and update Deploy command and change Setup Deploy command template #1747 by @thedavidprice
β οΈ - CLI: Rebuild Prisma Client between upgrades #1155 by @noire-munich
- CLI: improve rw prisma command options handling #1746 by @thedavidprice
- CLI: Improvements to
rw prisma
alias #1750 by @peterp - CLI: Prisma migrate dev now handles schema path with spaces #1753 #1762 by @dthyresson
- CLI: Specify node_env before running build web #1755 by @dac09
- CLI: Disable --version and -v for prisma alias #1767 by @peterp
- CLI: yarn rw prisma commands now show a little tip #1772 by @dac09
- Tests: MockProvider β Wrap children in LocationProvider #1681 by @Tobbe
- Tests: Update Test command to use new Prisma command #1745 by @thedavidprice
- Tests: use prisma db push for test DB #1768 by @thedavidprice
- TS: Router: Explicitly build types #1722 by @Tobbe
- TS: Router: Automatically import .ts Page files #1723 by @Tobbe
- TS: Format generated *.d.ts files #1724 by @Tobbe
- TS: Fix router typescript problem #1737 by @dac09
- TS: Specify types for the router package #1741 by @dac09
- Internal: update all contributors and add forrest and kim-adeline #1710 #1763 by @thedavidprice
- Internal: Don't run PR build actions on forks #1712 by @Tobbe
- Internal: Updated Status of Storybook in Technologies #1735 by @VinayaSathyanarayana
- Internal: update CRWA template remove dynamic provider and related copy #1743 by @thedavidprice
- Internal: Make e2e tests use local packages #1761 by @peterp
- Prisma: upgrade Prisma v2.16.0/1 and replace
rw db
commands withrw prisma
#1720 #1766 #1774 by @thedavidprice πβ οΈ - See "Breaking" and "How to Upgrade" sections below
- Release Notes: v2.13.0, v2.13.1, v2.14.0, v2.15.0, v2.16.0, v2.16.1
- HIGHLIGHTS: New Prisma Migrate (preview), Native DB types support (Preview), Integrated database seeding (Preview), Improved API for filtering arrays in PostgreSQL, More powerful counting of records using
select
- Preview Features:
createMany
,orderBy
,groupBy
- see Prisma Release Notes above for many many more updates
- HIGHLIGHTS: New Prisma Migrate (preview), Native DB types support (Preview), Integrated database seeding (Preview), Improved API for filtering arrays in PostgreSQL, More powerful counting of records using
Added
- Auth: Adds Facebook to list of supported Supabase OAuth providers #1739 by @dthyresson π
- API: Support unix socket or port for functions server #1689 by @brentjanderson
Fixes
- Structure: Fix import in RWProject in rw/structure #1707 by @dac09
- Structure: "pisma" is probably "prisma" #1779 by @jangxyz
- Tests: Ensure all data is removed during the teardown step #1714 by @tctrautman
- Cells: don't pass cell children to useQuery #1734 by @wminshew
- Storybook: applying afterQuery in storybook mocks #1740 by @dac09
- Internal: CRWA Readme β Add missing comma #1715 by @Tobbe
- Internal: Fix obejct typo #1716 by @ajcwebdev
- Internal: Corrects dataMigrate install instructions #1718 by @dthyresson
- Internal: Fix env loading in users webpack config #1729 by @dac09
- CLI: Fix rw prisma alias bugs #1760 by @peterp
Breaking β οΈ
Due to Prisma's release of the new Migrate feature + CLI (and deprecation of previous), this release includes several breaking changes that affect all projects:
- previous Prisma migrations are deprecated and replaced
- this means your local dev DB is broken, but also fixable (see guides and "how to upgrade" below)!
- and, yes, you'll need to walk through some step to update your production DB's migrations
- Dynamic Provider deprecated
redwood db [option]
command deprecated and replaced withredwood prisma [option]
- this also means
redwood db seed
is deprecated and replaced with Prisma DB Seed
- this also means
- Deployment command set deprecated and replaced
1. Deprecated yarn rw db
command
Due to the new Prisma CLI, all rw db
commands are now deprecated.
- They've been replaced with new
rw prisma
commands β check out the Redwood CLI Doc- and also read through Prisma Migration Flows using the CLI
- For a full guide to the Prisma CLI, see this Doc
- NOTE:
rw db seed
has been replaced withrw prisma db seed
β code modification required
2. Breaking: Deployment Command
Because the redwood db
command is deprecated, the command string used to build for deployment has also been replaced.
- Use
yarn rw deploy [target]
β see the Doc - Vercel hard codes the default Build Command into their dashboard. You'll need to log in and override if it's not using
rw deploy
- Netlify requires a code mod to your project's
netlify.toml
3. Old Migrations are Broken. Long live the New Prisma Migrations!
Along with new commands to manage your DB in development and Production, you'll need to take steps to upgrade to use the New Migrations. It's non-destructive for production DBs. See "How to Upgrade" below and the walkthrough guide.
4. Prisma's Dynamic Provider is Deprecated: No more dual DBs
You can no longer use both SQLite and Postgres at the same time, which previously was set in schema.prisma
as provider = ["sqlite", "postgresql"]
. From here on out you'll have to make a choice. It's a bummer, yes. But it's better for us all in the long run. See "How to Upgrade" below.
How to upgrade Redwood to the latest v0.25
π IMPORTANT: Skipping versions when upgrading is not recommended and will likely cause problems. Do read through all Release Notes between your current version and this latest version. Each minor release will likely require you to implement breaking change fixes and apply manual code modifications.
Most of these steps are covered in this Upgrading to Redwood v0.25 Guide, including steps to upgrade your production DB using the new
prisma migrate resolve
command
Upgrade Packages
Typically we suggest making code modifications before you upgrade packages. However, in this release, you'll need the new packages to run through code modification steps.
Run the following command within your App's directory:
yarn rw upgrade
Need help or having trouble upgrading packages? See this forum topic for manual upgrade instructions and general upgrade help.
Manual Code Modifications
1. Reminder: Remove Directly Installed Prisma Packages
If you've previously added Prisma packages directly to your project package.json
or api/package.json
, now's the time to rem...
v0.24.0
Come join us at the next RedwoodJS Meetup on Thursday, February 11th!
- π See this Forum post for details and free registration.
This release contains Breaking Changes. See the "Breaking" section for more information.
v0.24.0 Highlights π
Ethereum Auth Provider
Thanks to @pi0neerpat, you can now use Ethereum as an Auth provider in your Redwood App!
- Redwood Auth Doc
- Instructions and Package for API Setup
- Ethereum Auth Tutorial (note: this tutorial is also a great reference for anyone who wants to explore creating their own custom auth)
Change GraphQL Client
This has been a work in progress by both @peterp and @Tobbe. Redwood still ships with first-class Apollo Client support, but as of this release, it's been fully decoupled. You can use another client of your choice (or no provider if you'd like), and Apollo Client will not be referenced or installed.
- For instructions, see this Blog Post by Tobbe Lundberg
- This update is a breaking change. See the "Breaking" section below.
Changed
- GraphQL: Don't bundle Apollo Client if the user specifies their own client #1639 by @Tobbe
β οΈ π - CLI: Move deploy and auth from generate to setup #1685 by @dac09
- this deprecates
rw g auth
,rw g deploy
, andrw g util
in favor ofrw setup [auth | deploy | etc]
- this deprecates
- Auth: Azure Active Directory updating default auth request for acquireTokenSilent #1703 by @jeliasson
- Router: TypeScript rewrite #1666 by @Tobbe
- Internal: Replaced merge-graphql-schemas with graphql-tools #1322 by @himankpathak
- Internal: vendor create app template #1637 by @pepibumur
- Internal: add codemod to e2e so web tests pass #1708 by @thedavidprice
- Docs: Revise the CRWA package README #1668 by @thedavidprice
Added
- Auth: Add Auth Provider - Ethereum #1594 by @pi0neerpat π
- Auth: Support Supabase OAuth and Magic Link auth #1669 by @dthyresson
- TS: Make auto-import pages support .tsx files #1651 by @peterp
- Internal: Task script to update all packages #1662 by @peterp
- Doc: Update Contributing.md with all steps for Release Process #1686 by @thedavidprice
Fixes
- Auth: Fix/use fresh tokens #1627 by @dac09
β οΈ - Auth: Verify supabase, netlify and goTrue auth tokens in prod #1653 by @Tobbe
- Auth: Azure Active Directory refresh access token #1675 by @jeliasson
- Auth: Netlify decoder specifically check for dev and test #1654 by @Tobbe
- CLI: tailwind setup use fully specified paths #1648 by @Tobbe
- CLI: Fixes scaffolded test template #1690 by @cannikin
- Prisma: GQL Playground: Only run in dev mode #1655 by @Tobbe
- Storybook: Small Storybook webpack fix #1656 by @pi0neerpat
- Structure: Fix cell comment #1657 by @Tobbe
- Internal: Ignore linting template folder in create-redwood-app #1674 by @dac09
- Internal: Add build:js script for CRWA #1678 by @peterp
- Internal: Remove package.json exports and use a subfolder hack instead #1679 by @peterp
- Internal: redwood-tools ignore crwa template #1680 by @Tobbe
- Internal: Make test-tutorial use template directory & fix azure imports #1684 by @peterp
- Internal: Update and fix package builds to match lerna build #1687 by @thedavidprice
- Internal: Add missing env changes to template #1699 by @thedavidprice
- Internal: Fix dependencies #1696 by @peterp
- Doc: Fix typo in Private Routes #1698 by @morganmspencer
Breaking β οΈ
This release includes a breaking change that affects all projects. There are two other items that may affect some projects.
1. Breaking: Removed and Replaced <RedwoodProvider>
(affects ALL projects)
To support switching GraphQL Clients, <RedwoodProvider>
has been removed and replaced with <RedwoodApolloProvider>
, which imports from @redwoodjs/web/apollo
.
- See "Manual Code Modifications" below for upgrade instructions
- Related PR #1639
2. Deprecation Warning: Auth Tokens are now refreshed when they expire
authToken
is being deprecated and will be removed in future release. Use getToken()
instead.
- Related PR #1627
3. Bug: Prisma intermittent write EPIPE error
There is a known API bug in Prisma v2.12 through v2.14 (v2.12 is used by Redwood in this release). This issue affects deployed projects using Serverless API and causes intermittent 502 errors with a console log message including "write EPIPE + Cannot read property 'onError' of undefined". Until Redwood is upgraded to the most recent version of Prisma with the bug fix, v2.15, you can work around the issue based on your project's needs and infrastructure. See this Redwood Forum Topic for more information.
- This does not affect the Redwood Tutorial experience. If you see a 502 error after deployment, simply refresh the page
- For production apps using the Prisma Dynamic Provider option (e.g. both SQLite and PostgreSQL), it is recommended you downgrade your project to Prisma v2.11. Run
yarn add -W @prisma/[email protected] @prisma/[email protected] @prisma/[email protected]
. - For production apps not using Dynamic Provider, it is recommended you upgraded to Prisma v2.15, which will also require using the Prisma CLI new migrate commands (until they are supported by Redwood CLI in a future release). See this Forum Discussion Topic for an overview and instructions.
- Related Prisma Issues #4557 and #4744
How to upgrade RedwoodJS to the latest v0.24
π IMPORTANT: Skipping versions when upgrading is not recommended and will likely cause problems. Do read through all Release Notes between your current version and this latest version. Each minor release will likely require you to implement breaking change fixes and apply manual code modifications.
Manual Code Modifications
1. Remove <RedwoodProvider>
and Replace with <RedwoodApolloProvider>
See this commit for reference.
In your project, you must replace each instance of <RedwoodProvider>
with <RedwoodApolloProvider>
. The following example shows the steps to update index.js
:
- Remove
<RedwoodProvider>
and import<RedwoodApolloProvider>
separately:
// index.js
...
import { FatalErrorBoundary } from '@redwoodjs/web'
import { RedwoodApolloProvider } from '@redwoodjs/web/apollo'
...
- Replace
<RedwoodProvider>
with<RedwoodApolloProvider>
inindex.js
// index.js
...
<RedwoodApolloProvider>
<Routes />
</RedwoodApolloProvider>
...
Search your project for other instances of <RedwoodProvider>
and follow the steps above.
Upgrade Packages
Run the following command within your App's directory:
yarn rw upgrade
Need help or having trouble upgrading? See this forum topic for manual upgrade instructions and general upgrade help.
v0.23.0
Redwood is kicking off 2021 with back-to-back releases. π This version also adds the final piece of code for the launch of the Redwood Tutorial Pt 2 βΒ stay tuned!
Come join us for a RedwoodJS Meetup on Thursday, January 14! π See this Forum post for details and free registration.
v0.23.0 Highlights
1. Redwood Console
Launch your very own interactive Redwood shell with yarn rw console
- This feature is experimental and limited to DB. Docs here.
2. Fix for Redwood v0.22 web/
hoisted node_modules
issue
Redwood v0.22 experienced a strange issue with node_modules
being hoisted to the web/
directory. If you are upgrading from a v0.22 project and/or are having an issue with 'node_modulesbeing hoisted to your
web/` directory, see the "Manual Code Modifications" section below for the fix.
Changed
- Console: resolve promises in the console #1619 by @jtoar
- Generators: Replace prisma deprecated fineOne() -> findUnique() #1629 by @cannikin
- Docs: Update All-contributors and include Learn repo #1621 #1634 @thedavidprice @adithyasunil26
- Ops: update PR package Action formatting #1635 #1638 @thedavidprice @Tobbe
Added
- Tests: adds mockCurrentUser() to API-side Jest #1624 by @cannikin
- Env: Add TEST_DATABASE_URL to the default .env create-redwood-app/#123 by @jvanbaarsen
Fixes
- Tests: move whatwg-fetch from devDep to dep #1625 by @Tobbe
- Template: fix issue with web/ dependencies being hoisted to
./web
11780ed by @peterp
Breaking β οΈ
Nothing to see here π
How to upgrade RedwoodJS to the latest v0.23
π IMPORTANT: Skipping versions when upgrading is not recommended and will likely cause problems. Do read through all Release Notes between your current version and this latest version. Each minor release will likely require you to implement breaking change fixes and apply manual code modifications.
Manual Code Modifications
1. Add Test DB Env Var
Projects running a database other than SQLite will need to include an env var to config a local DB for testing. Admittedly, this has not (yet) been well documented.
- Add the env var
TEST_DATABASE_URL
to your projects.env
- See this commit, which adds an example to the installation template's
.env.defaults
.
2. Downgrade "react" and "react-dom" packages in web/package.json
(if applicable)
In the Redwood v0.22
release, both "react" and "react-dom" packages were upgraded to v17
. However, this created a weird/strange/unexpected issue where packages were being hoisted from root to the web/
directory, resulting in seemingly random errors with Jest test failures and React hook errors.
- The fix --> downgrade both "react" and "react-dom" in
web/package.json
to16.13.1
- See this commit for a reference
Upgrade Packages
Run the following command within your App directory:
yarn rw upgrade
Need help or having trouble upgrading? See this forum topic for manual upgrade instructions and general upgrade help.
v0.22.1
Happy New Year π₯³ And what an exciting year it's going to be for Redwood. Things are kicking off with a π
π Join us for the upcoming RedwoodJS Meetup on Thursday, January 14th. We're going to be talking about plans for the upcoming v1, all the shiny new things in this release, and have a demo of a new production Redwood app.
π Help us improve the upcoming Redwood Tutorial Pt 2. In preparation for the v1 release, we're again using Tutorial-Driving-Development to guide the way. We need your help trying it out before it's published.
And now on to the amazing work included in this release thanks to the amazing, collaborative community of people listed below.
v0.22 Highlights
Azure AD Authentication Provider
That's right, Azure AD is supported out of the box thanks to @jeliasson.
- Documentation
- PR #1311
New Test Scenarios
Testing with mock data just got a whole lot easier thanks to @cannikin The new Scenarios are data that is pre-set into the database at the start of your test and removed afterward.
- Read the full explanation and how to use in #1465
- And keep a lookout for the deep-dive in the upcoming Tutorial Pt 2
Bring your own GraphQL Client Library
Redwood ships with Appollo GraphQL Client, but we recognize that's not necessarily the right choice for every project. Thanks to @peterp, you can now swap out for the tool of your choice!
Changed
- CLI: update diagnostics to display a success message when no errors or warnings are encountered #1405 by @M0nica
- CLI: Update Setup TailwindCSS to v2 using PostCSS v7 compatible install #1540 by @jtoar
- CLI: Tailwind setup use fs.renameSync instead of mv #1579 by @Tobbe
- GraphQL: Allow users to "bring your own" GraphQL Library #1498 by @peterp π
- Forms: Improve typings for errors #1510 by @Tobbe
- UI: Only stop rendering on Private routes #1519 by @peterp
- Webpack: Make webpack load .mjs extensions #1528 by @peterp
- Auth: upgrade to Supabase 1.0; [email protected] with cleaner imports #1536 #1564 by @Tobbe
- this is a breaking change for projects currently using Supabase. See "Breaking Changes" section below.
- MSW: Explicit target environment for MSW #1574 by @peterp
- Docs: Contributors consolidate Core Team with Roles and update with new contributors #1541 by @thedavidprice
- Docs: Clarify CONTRIBUTING.md #1580 by @jtoar
- Prisma: Upgrade Prisma v2.12.1 #1604 by @thedavidprice
- Release Notes for v2.12.0 and v2.12.1
- Standalone Prisma Studio app for macOS
- Prisma codemods help upgrading your codebase
- Microsoft SQL Server now supports native database types (Preview)
- BREAKING: Remove non-$ methods
- BREAKING: 1-1-relations must now have an optional side
- BREAKING: Fix how data for Json[] fields is stored
- DEPRECATION: Rename findOne to findUnique
- DEPRECATION: Move most types under the Prisma namespace
Added
- Auth: Support Azure AD authentication #1311 by @jeliasson π
- CLI: Add redwood console #809 by @jtoar
- CLI: Add flags to generators to skip tests and story files #1454 by @jvanbaarsen
- CLI: Add --pr to upgrade command #1552 by @Tobbe
- Tests: Test Scenarios #1465 by @cannikin π
- Storybook: Add --build option to
yarn rw storybook
#1516 by @peterp - Ops: GitHub Action PR packages #1530 by @Tobbe
- Auth: Firebase Signup login with email, password #1555 by @byudaniel
Fixes
- Lint: Orderliness and break avoiding lint rules, package.json flags #1381 by @Krisztiaan
- Lint: Fix jest-dom lint errors #1575 by @peterp
- Lint: Fixed a few eslint warnings #1582 by @Tobbe
- Storybook: Fixes Storybook/Webpack Out of Memory Error by using relative path to config stories location #1509 by @dthyresson
- Auth: Fix FetchConfigProvider to reprise handling no auth #1515 by @jtoar
- Auth: Supabase getToken uses session to get access_token so that graphql calls are authenticated #1539 by @dthyresson
- GraphQL: Fix renamed export QueryHooksProvider to GraphQLHooksProvider #1520 by @peterp
- Router: Include queryParams in redirectTo #1526 by @dac09
- Deploy: Fix aws_serverless config when api folder missing #1553 by @bennettrogers
- Babel: Make glob import dir ignore .scenarios. files. #1607 by @peterp
Breaking β οΈ
For projects using Supabase Auth
-
This release upgrades to Supabase v1, which requires a new env var
SUPABASE_JWT_SECRET
:- See https://redwoodjs.com/docs/authentication#supabase
- For reference, see #1536 and #1564
-
Additionally, the Supabase token is now decoded whereas before it was returned undecided.
- See how this is handled starting here in the package unit tests
Prisma custom implementations
This version uses Prisma v2.12, which includes the following breaking changes affecting some projects with related custom implementation:
- Remove non-$ methods
- 1-1-relations must now have an optional side
- Fix how data for Json[] fields is stored
If your project is affected, you'll need to review the Prisma v2.12 Release Notes.
Note: Prisma now includes a code mode command, which will help fix any issue. See the release notes for more info. General example:
cd my-app npm install @prisma/cli @prisma/client npx @prisma/codemods update-2.12 ./
How to upgrade RedwoodJS to the latest v0.22
π IMPORTANT: Skipping versions when upgrading is not recommended and will likely cause problems. Do read through all Release Notes between your current version and this latest version. Each minor release will likely require you to implement breaking change fixes and apply manual code modifications.
Upgrade Packages
Run the following command within your App directory:
yarn rw upgrade
To run the upgrade
command, your project must be using v0.6.0 or greater. See this forum topic for manual upgrade instructions and general upgrade help.
v0.21.0
π Join us for the upcoming RedwoodJS Meetup on Thursday, December 3rd.
v0.21.0 Highlights
A huge Thank You to everyone who contributed to documentation on redwoodjs.com. π€©
And π to @dac09 and @Tobbe for these release highlights as well as all the fantastic individuals below who made this release possible!
Experimental support for React fast-refresh!
React fast refresh is a development-time feature that improves the "Hot reloading" functionality. The biggest benefit is that your components maintain state when you save them and they're refreshed on the screen. Learn more here about this feature.
To add support for fast-refresh, edit your redwood.toml
file and add the following:
[web]
# ... others
experimentalFastRefresh = true
Restart you development process and you should be good to go!
Added multiproviders to firebase auth!
Now, when you logIn()
or signUp()
with the firebase auth client, you can optionally specify the provider: google.com
, facebook.com
, github.com
, twitter.com
, microsoft.com
or apple.com
. The default is google.com
.
Converted @redwoodjs/forms
to TypeScript!
More progress toward the Redwood v1 TS support goals!
Changed
- Apollo: Add fetchPolicy and nextFetchPolicy to beforeQuery #1428 @cannikin
- Apollo: Remove unnecessary refetchQuery calls #1497 @cannikin
- Tests: update Cell tests to just test that nothing is thrown #1397 @cannikin
- Tests: default sides to "all" in test command #1414 @cannikin
- CLI: updated the CLI command rw generate deploy anchor links to match the documentation for Netlify and Vercel #1422 @dhausser
- Docs: update contributors #1430 @thedavidprice
- Docs: Update create-redwood-app readme to fix npm result #1484 @jacebenson
- Ops: use api/db for E2E test #1500 @thedavidprice
- Prisma: Upgrade to Prisma
v2.11.0
#1499 @thedavidprice- 2.11.0 Release Notes
- Native database types in the Prisma schema (Preview)
- New types in the Prisma schema: BigInt, Bytes and Decimal (Preview)
- Set foreign keys directly (Preview)
- 2.10.2 Release Notes
- 2.10.1 Release Notes
- 2.10.0 Release Notes
- Support for Microsoft SQL Server (Preview)
- Single-command schema changes for prototyping
prisma db push
(Preview)
- 2.11.0 Release Notes
Added
- Auth: added multiproviders to firebase auth! #1412 @dac09 π
- TS: converted @redwoodjs/forms to TypeScript! #1431 @Tobbe π
- Dev: experimental support for React fast-refresh! #1461 #1463 #1464 @dac09 π
- see "Highlights" above for instructions
- Ops: GH Action to create packages from PRs #1459 #1485 #1477 @Tobbe
- Storybook: add
open
flag,yarn rw storbook --open
will now open the browsers. #1445 @jvanbaarsen - Storybook: add Redwood's "node" Webpack config to Storybook's Webpack config. #1491 @jderrough
- Server: http server tweaks. #1441 @peterp
- Prisma: added
{ redwood { prismaVersion } }
field to GraphQL #1425 @jvanbaarsen - Prisma: add ability to specify a custom path for the
prisma.schema
#1424 @dhausser - CRWA: Quick start message added to
yarn create redwood-app
#1388 @kevPo
Fixes
- Prisma: fix field resolver not working #1440 @AntonioMeireles
- Prisma: bug fix
prisma.disconnect
deprecated warning #1404 @guillaumeLamanda - Prisma: fixes setting Prisma Version in root redwood schema #1442 @AntonioMeireles
- Prisma: use original prisma schema path #1486 #1488 @peterp
- Generator: fix nested scaffolding QUERY import paths #1432 @forresthayes
- Fixes DB Generators failing when a schema path includes spaces or other problematic characters #1492 @dthyresson
- Tests: fix
rw test
logic #1415 @cannikin - Tests: overwritten DATABASE_URL wasn't being used in actual Jest run #1446 @cannikin
- Tests: run jest api tests in sequence. #1447 @cannikin
- Tests: fix tests when the project app path includes spaces or other problematic characters #1494 @dthyresson
- Setup: fix tailwindcss setup command #1407 @mohinderps
- Docs: fix a typo in the contribution guide :) #1401 @olance
- Docs: fix typo in User route param types section #1466 @ajcwebdev
- Storybook: launch Storybook with path w/ spaces #1495 @dthyresson
Breaking β οΈ
[Minor Change] In this release, the Apollo fetchPolicy
and nextFetchPolicy
were changed for Redwood Cell's beforeQuery
. It's possible that cache behavior may change for custom implementations of Apollo cache configuration. However, it's unlikely the majority of Redwood projects will experience any changes after upgrading β tests demonstrated backwards compatibility. (See #1428) Also relevant are updates to Scaffold Generators no longer requiring refetchQuery
calls. Note: existing refetchQuery
configuration is backwards compatible. (See #1497)
How to upgrade RedwoodJS to v0.21.0
π IMPORTANT: Skipping versions when upgrading is not recommended and will likely cause problems. Do read through all Release Notes between your current version and this latest version. Each minor release will likely require you to implement breaking change fixes and apply manual code modifications.
Manual Code Modifications
The following code modifications are recommended but not required.
- [Recommended] Rename
api/prisma
toapi/db
This change is not required. New installations of Redwood now use the directoryapi/db
instead ofapi/prisma
. If you change the directory name in your project, you must also add aschemaPath
config toredwood.toml
. See #116 for code change example.
// redwood.toml
...
[api]
port = 8911
schemaPath = "./api/db/schema.prisma"
...
- [Recommended] Remove
schema.prisma
"rhel-openssl-1.0.x"binaryTarget
Prisma v2.11.0 (included in this release) fixes the requirement for adding "rhel-openssl-1.0.x". Removing thisbinaryTarget
may also reduce the size of the built API. See #115 for code change example.
// api/db/schema.prisma
...
generator client {
provider = "prisma-client-js"
binaryTargets = "native"
}
...
Upgrade Packages
Run the following command within your App directory:
yarn rw upgrade
To run the upgrade
command, your project must be using v0.6.0 or greater. See this forum topic for manual upgrade instructions and general upgrade help.
v0.20.0
This is definitely a mega release! π£ Just scroll through all the work below, contributed by so many individuals. Hats off to the active, growing Redwood community! Version v0.20.0 is amazing because of you. π
β οΈ This version contains breaking changes and manual code modifications. See the "Breaking" and "Manual Code Modifications" sections below for more info and upgrade instructions.
v0.20.0 Highlights
If this version has a theme, it's performance. Most of the highlights below are under-the-hood improvements and hard-earned fixes.
- Improved Router Performance #1284
- Improved GraphQL Cache Handling (Apollo) #1250 #1387 #1342
- Improved TypeScript Support for Web #1232 #1241 #1247 #1291
- Added Setup Command for one-step install and config and install #1154 #1234 #1269 #1282 #1294
- after upgrading, run
yarn redwood setup --help
to see current commands
- after upgrading, run
- Fixed Jest Test Command #1376
- Fixed Storybook Command on Windows #1324
Additionally, a huge Thank You to everyone who contributed to documentation on redwoodjs.com. π€©
Changed
- Apollo: Revert to default Apollo fetch policy #1250 by @amorriscode
β οΈ - Apollo: Add refetch queries to create and delete mutations #1387
β οΈ - CLI: modify generated tailwind config to opt-in to upcoming change #1179 by @forresthayes
- CLI: add compatibility comment to color/style palettes in cli packages #1210 by @jeliasson
- CLI: improve Upgrade command so
-t
accepts any string #1270 - CLI: add validation for tag supplied to rw upgrade #1304 by @dac09
- CLI: improved Scaffold error output #1320 by @santhoshle
- CLI: SDL generator: id only needed for CRUD #1327 by @Tobbe
- CRWA: improve installation success message #1195 by @jeliasson
- CRWA: update CRWA success message #1373 by @robobunny
- Prisma: remove deprecated argument from prisma studio call #1298 by @AntonioMeireles
- Prisma: upgrade prisma v2.9.0 #1206 #1300 #1344
- v2.9.0 Release Notes, v2.8.1 Release Notes, v2.8.0 Release Notes, v2.7.1 Release Notes, v2.7.0 Release Notes
findFirst
- Case insensitive filters for PostgreSQL are now stable
- Prisma Studio is Stable
- Configure Prisma schema location via package.json for more flexibility
- v2.9.0 Release Notes, v2.8.1 Release Notes, v2.8.0 Release Notes, v2.7.1 Release Notes, v2.7.0 Release Notes
- Structure: update VS Code private icon logic #1331 by @M0nica
- Router: add validation for private routes #1340 by @esteban-url
Added
- CLI: add the setup command #1154 #1234 #1269 #1282 by @noire-munich π
- CLI: add setup webpack.config.js for web #1294 by @dac09
- TS: make "@redwoodjs/web" TypeScript ready #1232 π
- TS: add types to createGraphQLClient and GraphQLProvider #1241 by @kimadeline π
- TS: add types to withCell #1247 by @kimadeline π
- TS: converted FatalErrorBoundary to typescript #1273 by @shzmr π
- TS: Add types to RedwoodProvider #1291 by @kimadeline π
- Tests: add jest-watch-typeahead #1208 by @RobertBroersma
- Docs: add structure/CONTRIBUTING.md #1357 by @aldonline
- Docs: Added Quick Start callout to Quick Start page #1386 by @kevPo
Fixed
- Router: Fix loaders initialization #1284 @jtoar @mojombo π
- Test: fix usage of private variable #1207 by @RobertBroersma
- Test: fix cwd in getConfigPath to actual cwd #1209 by @RobertBroersma
- Docs: Fix typos #1211 by @androiddevnotes
- Docs: updating contributing.md with install instructions #1231 by @M0nica
- Docs: fix misspelling of "contained" #1338 by @Irev-Dev
- Docs: redwoodjs.com docs Introduction link to node/yarn requirements #1358 by @brentguf
- CLI: don't create an AuthProvider if one exists #1251 by @amorriscode
- CLI: replace
<tt>
HTML elements with semantic<code>
HTML elements #1260 by @Thieffen - Structure: fix env visibility bug #1308 by @aldonline
- Structure: diagnostics throws error if a notfound route is within a Private tag #1325 by @M0nica
- Structure: fix router "Create Page..." codelens positon #1326 by @mbucchi
- Storybook: fix storybook on Windows #1324 by @Tobbe π
- Storybook: Fix auto-mocking #1378
- Babel: fix importing .ts/.tsx files in web with directory-named-import plugin #1332 by @dac09
- Bable: fix directory named imports #1364
- Forms: fix form error message display #1337 by @forresthayes
- Apollo: fix scaffold mutation #1342
β οΈ - Apollo: fix Apollo Client imports (and Test command) #1376 π
Breaking β οΈ
Appollo Client v3 Cache Behavior for GraphQL Mutations
Prior to this version, Redwood Cells used Apollo's cache and network
fetch policy. This has been removed in favor of the default policy (see #1250). This change, along with the new Apollo v3 behavior, changes the behavior of mutations β state changes will often not render without a page reload.
From the ApolloDocs: If a mutation modifies multiple entities, or if it creates or deletes entities, the Apollo Client cache is not automatically updated to reflect the result of the mutation.
tl;dr: if things with your App's CRUD rendering seem broken after upgrading, you'll need to update the Mutations in your components to use Apollo's new features like refetchQueries
:
- See this Apollo Doc about Mutations and Cache
- For a more advanced approach and example using
inMemoryCache
, see this Forum Topic by @jtoar - Redwood Scaffold generated CRUD will also need to be updated. See the "Manual Code Modifications" section below.
Prisma Query Engine Deploy Error
Prisma v2.9.0
now requires setting an additional binaryTarget
in schema.prisma
. Otherwise, the Prisma query engine will not build correctly, resulting in an error affecting the production deploy.
- See the "Manual Code Modifications" section below for required changes
How to upgrade RedwoodJS to v0.20.0
π IMPORTANT: Skipping versions when upgrading is not recommended and will likely cause problems. Do read through all Release Notes between your current version and this latest version. Each minor release will likely require you to implement breaking change fixes and apply manual code modifications.
Manual Code Modifications
- Prisma
v2.9
requires an additionalbinaryTarget
for production deploys to build correctly:- add the additional binaryTarget
"rhel-openssl-1.0.x"
toapi/prisma/schema.prisma
- see this example
- add the additional binaryTarget
- VS Code GraphQL extension required config:
- this GraphQL Extension is recommend for VS Code projects
- add
graphql.config.js
to your project root; see this example with code
- Update Scaffold generated Component files (or, in some cases, your own custom mutation implementations)
- Redwood Scaffold generated CRUD needs to be updated in order to work with the new Apollo v3 Cache. There are four generated component files that need to be updated for each generated Scaffold. The specific names will be different based on your schema models. For the Tutorial
post
model as an example, the files to update are the components/Post/Post.js
,/Posts/Posts.js
,/NewPost/NewPost.js
, and/EditPostCell/EditPostCell.js
- Note: One way to handle this is to re-run Scaffold Generator with the
--force
option. π¨ It's the fastest. But this will overwrite any customization. - Edit [Model].js, [Model]s.js, and New[Model].js Components (e.g. Post.js, Posts.js, and NewPost.js):
- See the three files in this commit for reference. Note: the reference file are
Name.js.template
,Names.js.template
, andNewName.js.template
- For each file, add
import { QUERY } from 'src/components/${pluralPascalName}Cell'
- For the respective
DELETE
andCREATE
mutation'sonCompleted
property, addrefetchQueries: [{ query: QUERY }], awaitRefetchQueries: true,
- For the [Model]s.js file, remove the current
refetchQueries
property from theonDeleteClick
conditional
- See the three files in this commit for reference. Note: the reference file are
- Edit the Edit[Model]Cell.js Component (e.g. EditPostCell.js):
- See the
EditNameCell.js.template
file in this commit for reference - The
UPDATE
mutation requires passing all properties, not justid
in the same manner as theQUERY
- Add all
QUERY
properties (e.g.id
,title
,body
,createdAt
) to theUPDATE_[Model]_MUTATION
- See the
- Redwood Scaffold generated CRUD needs to be updated in order to work with the new Apollo v3 Cache. There are four generated component files that need to be updated for each generated Scaffold. The specific names will be different based on your schema models. For the Tutorial
Upgrading is worth it! And, more importantly, there's a vibrant community for help (and encouragement) if you need it.
- Have questions or need help upgrading? Check out this Forum Topic.
- We're evaluating how to handle the Redwood Client GraphQL. Check out this Forum Topic to learn more and share your experience and suggestions.
Upgrade Packages
Run the following command within your App directory:
yarn rw upgrade
*To run the upgrade
command, your project must be using v0.6.0 or greater. [See this forum topic for manual upgrade instructions and general upgrade help](https://community.redwoodjs.com/t/how-to-upgrade-redwoodjs-app-and-...