cashay-playground icon indicating copy to clipboard operation
cashay-playground copied to clipboard

The playground for exploring what's possible with Cashay

cashay-playground

really boring & uninteresting & definitely not click worthy

Installation

  • git clone https://github.com/mattkrick/cashay-playground.git
  • npm i && npm start
  • npm run updateSchema (optional, run this whenever you change the schema)

Things to do in the playground

  • Server calls are delayed by 1 second to see all the optimistic goodness
  • Notice that checking loading status is really, really easy
  • Click "get 2 more" and notice that the button goes away after you've got em all without a 2nd request to the server.
  • Click "show comments" on the first post to see 2 comments load
  • Add a comment & notice that you can add it anywhere in the array (in this case, it's sorted by karma & starts you out at 0)
  • Add a post & notice that the optimistic update is immediate & the response from the server overwrites your optimistic update
  • Adding a post updates the array and the post count.
  • Crack open the Chrome Redux Devtools and take a look at your sexy, sexy store

Things to notice in the code

  • I never wrote a single mutation on the client (no variableDefinitions, no response or fat query, nothing).
  • For most mutations, you don't even need to include a components options, it'll just grab all the queries with the corresponding handlers
  • Your mutation handler can do ANYTHING. seriously, ANYTHING