Skip to content

Commit 002ab9a

Browse files
committed
Enhancement: better version checks (#935)
* Enhanced version checks * Prettier * Build assets * Change threshold for survey * Remove console.log
1 parent a2284fb commit 002ab9a

File tree

6 files changed

+42
-26
lines changed

6 files changed

+42
-26
lines changed

assets/app/app.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import Alpine from 'alpinejs';
22
import collapse from '@alpinejs/collapse';
3+
import lt from 'semver/functions/lt';
34

45
import Collapsible from './hooks/collapsible';
56
import Fullscreen from './hooks/fullscreen';
@@ -83,10 +84,11 @@ function setTheme() {
8384

8485
async function checkForUpdate(currentVersion) {
8586
const shouldShowPopup = (latestVersion) => {
86-
return (
87-
currentVersion !== latestVersion &&
88-
localStorage.getItem('lvdbg:ignored-version') !== latestVersion
89-
);
87+
const isOlder = lt(currentVersion, latestVersion);
88+
const isNotIgnored =
89+
localStorage.getItem('lvdbg:ignored-version') !== latestVersion;
90+
91+
return isOlder && isNotIgnored;
9092
};
9193

9294
const showPopup = (latestVersion) => {

assets/app/hooks/survey_banner.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const SurveyBanner = {
2-
counterThreshold: 100,
2+
counterThreshold: 20,
33
mounted() {
44
if (localStorage.getItem('lvdbg:survey-dismissed-permanently')) return;
55

assets/app/package-lock.json

Lines changed: 14 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/app/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"codemirror-lang-elixir": "^4.0.0",
1313
"phoenix": "^1.7.17",
1414
"phoenix_html": "^3.3.4",
15-
"phoenix_live_view": "^1.0.0"
15+
"phoenix_live_view": "^1.0.0",
16+
"semver": "^7.7.4"
1617
},
1718
"devDependencies": {
1819
"prettier": "^3.5.1"

priv/static/app.js

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

priv/static/app.js.map

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)