Skip to content

Commit 4ae5c74

Browse files
committed
fix: hanging update button
1 parent c2158fd commit 4ae5c74

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "browsernaut",
33
"private": true,
4-
"version": "1.1.1",
4+
"version": "1.1.2",
55
"type": "module",
66
"scripts": {
77
"app:version": "echo $npm_package_version",

src/views/Preferences/components/tabs/TabAbout.tsx

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,20 @@ export const TabAbout = (): JSX.Element => {
2929
setIsCheckingForUpdate(true);
3030
setUpdateButtonContent('Checking for update.');
3131

32-
try {
33-
const interval = setInterval(() => {
34-
setUpdateButtonContent((prev) => {
35-
if (prev.endsWith('...')) {
36-
return prev.replace('...', '.');
37-
}
38-
return prev + '.';
39-
});
40-
}, 500);
32+
const resetTimeout = setTimeout(() => {
33+
setIsCheckingForUpdate(false);
34+
setUpdateButtonContent(BUTTON_UPDATE_STRING);
35+
}, 6000);
4136

37+
try {
4238
const updateResult = await checkUpdate();
43-
clearInterval(interval);
44-
4539
if (updateResult.shouldUpdate) {
4640
const result = await confirm(
4741
'There is an update available. Would you like to update now?'
4842
);
49-
43+
//? This isn't working as expected, the promise seems to never resolve if the user clicks no.
44+
clearTimeout(resetTimeout);
45+
setUpdateButtonContent('Update available!');
5046
if (result) {
5147
await installUpdate();
5248
return;
@@ -74,7 +70,6 @@ export const TabAbout = (): JSX.Element => {
7470
>
7571
{updateButtonContent}
7672
</Button>
77-
7873
<div className="gap-4 mt-auto mb-8">
7974
<p>Copyright © Billy Jacoby</p>
8075
<Button variant={'link'} onClick={() => openURL({ URL: HOMEPAGE_URL })}>

0 commit comments

Comments
 (0)