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.
Redwood Releases on GitHub
You can see all Redwood release notes and version history on GitHub