New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cashay #64
Conversation
remove redux-optimistic-ui (cleanup) fix ACtionHTTPTransport Update to cashay 0.8.1 perform auth through cashay
@@ -19,8 +19,8 @@ | |||
"build": "rimraf build && concurrently \"npm run build:client\" \"npm run build:server\"", | |||
"bs": "rimraf build && concurrently \"npm run build:client\" \"npm run build:server\" \"npm run start\"", | |||
"quickstart": "rimraf build && concurrently \"npm run db:migrate\" \"npm run build:client\" \"npm run build:server\" \"npm run start\"", | |||
"build:client": "NODE_ENV=production webpack -p --config ./webpack/prod.babel.js", | |||
"build:server": "npm run build:theme && NODE_ENV=production webpack -p --config ./webpack/server.babel.js", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these slow me down! ditching uglify makes dev much more fun. maybe we should write a separate deploy
script?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just use npm run dev
and leave build:client
and build:server
alone?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i use npm run bs
when working on the server. that way, i don't need to rebuild the client for every change i make to the server.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see! Seems like adding build:deploy
might be the way to go then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I can do that later)
Just ran it. Works great! Fix linting errors then, looking good! 😎 |
@@ -42,6 +42,8 @@ query { | |||
const mutationHandlers = { | |||
updateUserWithAuthToken(optimisticVariables, dataFromServer, currentResponse) { | |||
if (dataFromServer) { | |||
// TODO: modifing params by reference is stylisitically problematic, | |||
// can interface be pure and return new value intead? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's always good to be aware of mutating objects, but it shouldn't be a hard rule.
For example (since i learned about plugins yesterday...) almost every webpack plugin does this because it hands you a compilation
object and you stick something on it, eg compilation.assets[myFoo] = 'newFoo!'
. What else are they gonna do, hand you the parent of compilation
and make you return a whole new compilation
object? Nahhhh
Cashay does allow you to return a pure object, but here's how that looks:
Option 1:
const myResponse = JSON.parse(JSON.stringify(currentResponse));
myResponse.foo = 2;
return myResponse;
Option 2:
return Object.assign({}, currentResponse, {
cachedUserAndToken: Object.assign({}, currentResponse.cachedUserAndToken, {
user: Object.assign({}, currentResponse.cachedUserAndToken.user, {
id: dataFromServer.cachedUserAndToken.user.id
}
})
}
So I guess the answer is, want to play by the rules? Go ahead, no one is stopping you. But, if you wanna be a bad boy (without any risk!), go ahead & mutate 😈
in efforts to keep commits smaller & more frequent, i'd like to merge this. It doesn't do much more than a login + redirect in cashay, but then again that was a surprising amount of work.