Skip to content
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

Release notes bug #1679

Merged
merged 4 commits into from
May 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v12.18.3
6 changes: 3 additions & 3 deletions app/release-notes/maybe-show-release-notes.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {getVersion} from "app/core/utils/get-version"
import {releaseNotesPath} from "app/router/utils/paths"
import isDev from "src/js/electron/isDev"
import Current from "src/js/state/Current"
import Launches from "src/js/state/Launches"
import Tabs from "src/js/state/Tabs"
Expand All @@ -8,9 +8,9 @@ const isItest = process.env.BRIM_ITEST === "true"

export function maybeShowReleaseNotes() {
return (dispatch, getState) => {
if (!isDev && !isItest && Launches.firstRunOfVersion(getState())) {
if (!isItest && Launches.firstRunOfVersion(getState())) {
dispatch(showReleaseNotes())
dispatch(Launches.touchVersion())
dispatch(Launches.touchVersion(getVersion()))
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/js/state/GlobalContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ export const globalDispatchMiddleware = (_store) => (next) => (action) => {
const result = next(action)
if (action.type.startsWith("$") && !action.remote) {
// Don't re-broadcast a message that was broadcast to you
invoke(ipc.globalStore.dispatch(action))
invoke(ipc.globalStore.dispatch(action)).catch((e) => {
console.error(e)
})
}
return result
}
5 changes: 2 additions & 3 deletions src/js/state/Launches/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ const slice = createSlice({
name: "$Launches",
initialState: {},
reducers: {
touchVersion: (state, action: PayloadAction<string | undefined>) => {
let key = action.payload || getVersion()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This getVersion() call was what was causing the error. It makes a sync ipc call to the 'main' process. But this code was being run in the "main" process.

state[key] = new Date().toISOString()
touchVersion: (state, action: PayloadAction<string>) => {
state[action.payload] = new Date().toISOString()
}
}
})
Expand Down
7 changes: 0 additions & 7 deletions src/js/state/Launches/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,3 @@ test("first run of version", () => {
store.dispatch(Launches.touchVersion("v0.2.0"))
expect(Launches.firstRunOfVersion(store.getState(), "v0.2.0")).toBe(false)
})

test("works without params", () => {
const store = initTestStore()
expect(Launches.firstRunOfVersion(store.getState())).toBe(true)
store.dispatch(Launches.touchVersion())
expect(Launches.firstRunOfVersion(store.getState())).toBe(false)
})