Spring is our CMS for managing our inventory and customers, processing reservations, but also visualizing our business data and metrics.
yarn
- Create a
.env
:cp .env.example > .env
yarn start
- Install Apollo DevTools. They help.
We are using
react-admin
as the scaffolding library- Devias Kit for the layout, components, and structure
MaterialUI
for componentsstyled-components
as css-in-jss processor of choiceApollo
as the data provider to interface with Monsoon, our backend API, andRedux
as the data store.
Isn't state the best?
Most views use components provided by react-admin
to make use of the dataProvider
directly. This works well for straightforward tables where we need to fetch a list of resources, paginate, filter, etc.
Custom queries are executed using react-admin
's useQueryWithStore
, which fetches the resource and stores it in the admin part of the Redux
store.
Mutations, on the other hand, are executed with Apollo
, which means state will not be optimistically updated without some extra work. A component that executes a mutation and needs to reflect newly updated data will have an adminKey
passed in as a prop, and will dispatch an action used by react-admin
to update it with the new data. Alternatves are a hard reload or forcing a refetch. Both result in extraneous requests going to the server. The expectation is that components will not do this, and will optimistically update instead.
- I updated a query, and now I'm getting a type error when I try to use the new field i added. What should I do?
Run
yarn apollo
and smile.