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

fix: now versions are properly showed when updating, only the relevan… #988

Merged
merged 2 commits into from
Jan 30, 2025
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Bazecor",
"productName": "Bazecor",
"version": "1.6.2",
"version": "1.6.3",
"description": "Bazecor desktop app",
"private": true,
"repository": {
Expand Down
3 changes: 1 addition & 2 deletions src/renderer/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ function App() {
const [fwUpdate, setFwUpdate] = useState(false);
const [loading, setLoading] = useState(false);
const [notifyNewVersion, setNotifyNewVersion] = useState(false);
const [oldSettings] = useState(store.get("settings"));

const saveButtonRef = useRef(null);
const discardChangesButtonRef = useRef(null);
Expand All @@ -78,7 +79,6 @@ function App() {
const navigate = useNavigate();
const varFlashing = React.useRef(false);
const device: any = React.useRef();
const oldSettings = store.get("settings");

const updateStorageSchema = async () => {
// Update stored settings schema
Expand Down Expand Up @@ -521,7 +521,6 @@ function App() {
<VersionUpdateDialog
open={notifyNewVersion}
oldVersion={oldSettings.version}
newVersion={version}
handleUpdate={handleUpdateVersion}
onCancel={() => setNotifyNewVersion(false)}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import React, { useEffect, useState } from "react";
import { Octokit } from "@octokit/core";
// import log from "electron-log/renderer";
import log from "electron-log/renderer";
import SemVer from "semver";
import parse, { domToReact } from "html-react-parser";

Expand All @@ -26,12 +26,12 @@ import { i18n } from "@Renderer/i18n";
import Heading from "@Renderer/components/atoms/Heading";
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@Renderer/components/atoms/Accordion";
import LogoLoader from "@Renderer/components/atoms/loader/LogoLoader";
import { version } from "../../../../../package.json";

interface VersionUpdateProps {
open: boolean;
onCancel: () => void;
oldVersion: string;
newVersion: string;
handleUpdate: () => void;
}

Expand Down Expand Up @@ -94,7 +94,7 @@ const options = {
};

export function VersionUpdateDialog(props: VersionUpdateProps) {
const { open, onCancel, newVersion, oldVersion, handleUpdate } = props;
const { open, onCancel, oldVersion, handleUpdate } = props;
const [data, setData] = useState<Releases[]>(undefined);

useEffect(() => {
Expand All @@ -111,17 +111,19 @@ export function VersionUpdateDialog(props: VersionUpdateProps) {
format: "full",
},
});
// log.info("Testing", GHdata);
log.info("Testing", GHdata);
GHdata.data.forEach(release => {
// eslint-disable-next-line @typescript-eslint/naming-convention
const { prerelease, name, published_at, body_html, tag_name } = release;
const newRelease = { name, version: tag_name, date: published_at, content: body_html };
if (!prerelease) releases.push(newRelease);
});
// log.info("Data from Dialog: ", releases, newVersion, oldVersion);
const versionToCheck = oldVersion || newVersion;
const parsedData = releases.filter(r => SemVer.compare(r.version, versionToCheck) >= 0);
// log.info("Data from Dialog: ", parsedData);
log.info("Data from Dialog: ", releases, version, oldVersion);
const parsedData = releases.filter(r =>
oldVersion
? SemVer.compare(r.version, oldVersion) > 0 && SemVer.compare(r.version, version) <= 0
: SemVer.compare(r.version, version) === 0,
);
setData(parsedData);
}
fetchData();
Expand Down
1 change: 0 additions & 1 deletion src/renderer/modules/Settings/GeneralSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@ const GeneralSettings = ({
<VersionUpdateDialog
open={versionDialog}
oldVersion={version}
newVersion={version}
handleUpdate={() => {}}
onCancel={() => setVersionDialog(false)}
/>
Expand Down
Loading