authCV initialized to null, getter used in checkAuth#340
Conversation
Pull Request Test Coverage Report for Build 1582
💛 - Coveralls |
frontend/src/store/auth/index.js
Outdated
| loading: ({ loading }) => loading, | ||
| error: ({ error }) => error, | ||
| authCV: ({ authCV }) => authCV | ||
| authCV: ({ authCV }) => { |
There was a problem hiding this comment.
This doesn't work. It'll just alter the param, not the underlying CV.
I suggest this:
const _authCV = new CV()
const state = {...}
const getters = { authCV: () => _authCV }
const mutations = { ...SIGNAL_AUTH_CV() { _authCV.signal() }}There was a problem hiding this comment.
can't i just not destructure state? that seems to work
authCV: (state) => {
if (state.authCV === null) state.authCV = new CV()
return state.authCV
}There was a problem hiding this comment.
Also this is why we should be using Rust for our frontend ^_^
frontend/src/store/auth/index.js
Outdated
| profile: null, | ||
| // condition variable for app to wait on while waiting for auth to resolve on boot | ||
| authCV: new CV() | ||
| authCV: null |
There was a problem hiding this comment.
and then just remove this.
|
|
||
| // signal the CV so the app can continue loading and use the JWT token in its requests | ||
| // Note we _need_ to do this before returning! | ||
| commit('SIGNAL_AUTH_CV') |
There was a problem hiding this comment.
And then retain this as a commit
hok then |
|
@NunoDasNeves also the previous deploy was broken so 👍 |
DarkPurple141
left a comment
There was a problem hiding this comment.
Could work.
Seems that getters which are calling mappers directly when object can be null are causing potential issues.
frontend/vue.config.js
Outdated
| postProcess (renderedRoute) { | ||
| // Ignore any redirects. | ||
| renderedRoute.route = renderedRoute.originalRoute | ||
| // Basic whitespace removal. (Don't use this in production.) |
There was a problem hiding this comment.
don't use in production? o.O
frontend/vue.config.js
Outdated
| // Ignore any redirects. | ||
| renderedRoute.route = renderedRoute.originalRoute | ||
| // Basic whitespace removal. (Don't use this in production.) | ||
| renderedRoute.html = renderedRoute.html.split(/<div id="app"/) |
There was a problem hiding this comment.
this has been added to index.html already
There was a problem hiding this comment.
Oh this is a quote I copy-pasta'd. Just wanted to see if this works to stop re-render.
frontend/.env.production
Outdated
| VUE_APP_TITLE=SmartCourse | ||
| VUE_APP_API_URL=https://smartcourse.me/api No newline at end of file | ||
| VUE_APP_API_URL=https://smartcourse.me/api | ||
| VUE_APP_URL=https://smartcourse-staging.azurewebsites.net No newline at end of file |
There was a problem hiding this comment.
uhh is this right?
frontend/.env.staging
Outdated
| NODE_ENV=staging | ||
| VUE_APP_TITLE=SmartCourse (staging) | ||
| VUE_APP_API_URL=https://smartcourse-staging.azurewebsites.net/api | ||
| VUE_APP_URL=https://smartcourse.me |
There was a problem hiding this comment.
i think you got these switcharoo'd
idk how to enable prerender on staging - it seems like it's enabled everywhere according to
src/backend/index.js??