From fbbec97562e4e7ddc3dcf1e2950d01abddb7915a Mon Sep 17 00:00:00 2001 From: Mikael Kristiansson Date: Thu, 1 Dec 2022 09:23:23 +0100 Subject: [PATCH] fix: notification call before store update --- CHANGELOG.md | 5 +++++ package.json | 2 +- src-tauri/Cargo.lock | 2 +- src-tauri/Cargo.toml | 2 +- src-tauri/tauri.conf.json | 2 +- src/lib/github.ts | 12 ++++++------ 6 files changed, 15 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aaa486a..7bbe41a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 0.4.1 + +### Fix +* change order when calling notification (before store update) + ## 0.4.0 ### Features diff --git a/package.json b/package.json index 31edada..03ca54d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "gitbar", "private": true, - "version": "0.4.0", + "version": "0.4.1", "type": "module", "scripts": { "dev": "vite", diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 3767c7b..7f56b5f 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -905,7 +905,7 @@ dependencies = [ [[package]] name = "gitbar" -version = "0.4.0" +version = "0.4.1" dependencies = [ "auto-launch", "cocoa", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 5726c5d..ed57c0e 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "gitbar" -version = "0.4.0" +version = "0.4.1" description = "Github review counter" authors = ["mikael.kristiansson"] license = "MIT" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 590d1ec..ee5a9fc 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -8,7 +8,7 @@ }, "package": { "productName": "GitBar", - "version": "0.4.0" + "version": "0.4.1" }, "tauri": { "allowlist": { diff --git a/src/lib/github.ts b/src/lib/github.ts index 95ed458..54118e0 100644 --- a/src/lib/github.ts +++ b/src/lib/github.ts @@ -31,6 +31,12 @@ const fetchReviews = async (account: AuthState) => { const res = await getReviews(account); let prevCount: number; github.subscribe(({ reviews }) => (prevCount = reviews.count)); + + if (res.issueCount > prevCount) { + const title = res.edges[0].node.title; + const author = res.edges[0].node.author.login; + notification(`${title} - @${author}`); + } if (res.issueCount !== prevCount) { github.update((prev) => ({ ...prev, @@ -41,12 +47,6 @@ const fetchReviews = async (account: AuthState) => { })); invoke('set_review_count', { count: String(res.issueCount) }); } - - if (res.issueCount > prevCount) { - const title = res.edges[0].node.title; - const author = res.edges[0].node.author.login; - notification(`${title} - @${author}`); - } }; export const github = writable({