gitxelectron 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/out/main/index.js CHANGED
@@ -825,12 +825,14 @@ async function getBranches(sessionId) {
825
825
  GIT_TERMINAL_PROMPT: "0",
826
826
  GIT_ASKPASS: "echo"
827
827
  });
828
- if (remoteObj.refs.fetch) {
829
- const authUrl = injectAuthToken(sessionId, remoteObj.refs.fetch);
830
- await tempGit.fetch(authUrl, { "--prune": null });
831
- } else {
832
- await tempGit.fetch(remoteObj.name, { "--prune": null });
833
- }
828
+ const FETCH_TIMEOUT_MS = 15e3;
829
+ const fetchPromise = remoteObj.refs.fetch ? tempGit.fetch(injectAuthToken(sessionId, remoteObj.refs.fetch), { "--prune": null }) : tempGit.fetch(remoteObj.name, { "--prune": null });
830
+ await Promise.race([
831
+ fetchPromise,
832
+ new Promise(
833
+ (_, reject) => setTimeout(() => reject(new Error("Fetch timed out")), FETCH_TIMEOUT_MS)
834
+ )
835
+ ]);
834
836
  }
835
837
  } catch (e) {
836
838
  }
@@ -24613,6 +24613,7 @@ function App() {
24613
24613
  const [autoSyncLogs, setAutoSyncLogs] = reactExports.useState([]);
24614
24614
  const [showAutoSyncLogs, setShowAutoSyncLogs] = reactExports.useState(false);
24615
24615
  const [isRefreshing, setIsRefreshing] = reactExports.useState(false);
24616
+ const refreshLockRef = reactExports.useRef(false);
24616
24617
  const [showWelcomeWizard, setShowWelcomeWizard] = reactExports.useState(false);
24617
24618
  const [newPin, setNewPin] = reactExports.useState("");
24618
24619
  const [pinChangeSuccess, setPinChangeSuccess] = reactExports.useState(false);
@@ -24777,7 +24778,7 @@ function App() {
24777
24778
  if (isRepo && repoPath) {
24778
24779
  interval = setInterval(() => {
24779
24780
  refreshRepoState();
24780
- }, 3e4);
24781
+ }, 12e4);
24781
24782
  }
24782
24783
  return () => {
24783
24784
  if (interval) clearInterval(interval);
@@ -24943,6 +24944,8 @@ function App() {
24943
24944
  }
24944
24945
  };
24945
24946
  const refreshRepoState = async () => {
24947
+ if (refreshLockRef.current) return;
24948
+ refreshLockRef.current = true;
24946
24949
  setIsRefreshing(true);
24947
24950
  try {
24948
24951
  setErrorMsg("");
@@ -24956,28 +24959,6 @@ function App() {
24956
24959
  setDeletedHistory(dh);
24957
24960
  } catch (err) {
24958
24961
  }
24959
- try {
24960
- const b = await window.api.getBranches();
24961
- setBranches(b);
24962
- const updatedStatus = await window.api.getStatus();
24963
- setStatus(updatedStatus);
24964
- if (autoSyncEnabled && updatedStatus.behind > 0) {
24965
- const remotes2 = await window.api.getRemotes();
24966
- if (remotes2.length > 0) {
24967
- try {
24968
- showToast(`Auto-Push: Downloading ${updatedStatus.behind} remote change(s)...`, "info");
24969
- await window.api.pullFromRemote(remotes2[0].name, b.current);
24970
- showToast("Auto-Push: Successfully synchronized remote changes!", "success");
24971
- const finalStatus = await window.api.getStatus();
24972
- setStatus(finalStatus);
24973
- } catch (e) {
24974
- console.error("Auto-Push Pull failed:", e);
24975
- }
24976
- }
24977
- }
24978
- } catch (e) {
24979
- setBranches({ current: "No commits yet", all: [] });
24980
- }
24981
24962
  const auth = await window.api.getAuthStatus();
24982
24963
  setAuthStatus(auth);
24983
24964
  const accs = await window.api.getAccounts();
@@ -25009,32 +24990,58 @@ function App() {
25009
24990
  } else {
25010
24991
  setRemoteUrl(null);
25011
24992
  }
25012
- if (auth.status === "Verified") {
25013
- if (remotes.length > 0) {
25014
- const remoteUrl2 = remotes[0].refs.push;
25015
- const hasPerm = await window.api.verifyPushPermission(remoteUrl2);
25016
- setPushPermission(hasPerm);
25017
- try {
25018
- const invs = await window.api.getUserInvitations();
25019
- setInvitations(invs || []);
25020
- } catch (e) {
25021
- console.error("Failed to fetch invitations", e);
24993
+ const deferredRemotes = remotes;
24994
+ (async () => {
24995
+ try {
24996
+ const b = await window.api.getBranches();
24997
+ setBranches(b);
24998
+ const updatedStatus = await window.api.getStatus();
24999
+ setStatus(updatedStatus);
25000
+ if (autoSyncEnabled && updatedStatus.behind > 0) {
25001
+ if (deferredRemotes.length > 0) {
25002
+ try {
25003
+ showToast(`Auto-Push: Downloading ${updatedStatus.behind} remote change(s)...`, "info");
25004
+ await window.api.pullFromRemote(deferredRemotes[0].name, b.current);
25005
+ showToast("Auto-Push: Successfully synchronized remote changes!", "success");
25006
+ const finalStatus = await window.api.getStatus();
25007
+ setStatus(finalStatus);
25008
+ } catch (e) {
25009
+ console.error("Auto-Push Pull failed:", e);
25010
+ }
25011
+ }
25022
25012
  }
25023
- try {
25024
- const collabData = await window.api.getCollaborators(remoteUrl2);
25025
- setRepoCollaborators(collabData.collaborators || []);
25026
- if (remoteUrl2 && repoPath) {
25027
- const cleaned = remoteUrl2.replace("https://github.com/", "").replace(/\.git$/, "");
25028
- saveMapping(cleaned, repoPath);
25013
+ } catch (e) {
25014
+ setBranches({ current: "No commits yet", all: [] });
25015
+ }
25016
+ })();
25017
+ if (auth.status === "Verified") {
25018
+ if (deferredRemotes.length > 0) {
25019
+ const remoteUrl2 = deferredRemotes[0].refs.push;
25020
+ (async () => {
25021
+ try {
25022
+ const hasPerm = await window.api.verifyPushPermission(remoteUrl2);
25023
+ setPushPermission(hasPerm);
25024
+ } catch (e) {
25025
+ console.error("Failed to verify push permission", e);
25029
25026
  }
25030
- if (collabData.collaborators?.length > 1 || collabData.invitations?.length > 0) {
25031
- window.api.getCollaboratedRepos().then((repos) => setCollaboratedRepos(repos || [])).catch(() => {
25032
- });
25027
+ try {
25028
+ const invs = await window.api.getUserInvitations();
25029
+ setInvitations(invs || []);
25030
+ } catch (e) {
25031
+ console.error("Failed to fetch invitations", e);
25033
25032
  }
25034
- } catch (e) {
25035
- console.error("Failed to fetch collaborators", e);
25036
- setRepoCollaborators([]);
25037
- }
25033
+ try {
25034
+ const collabData = await window.api.getCollaborators(remoteUrl2);
25035
+ setRepoCollaborators(collabData.collaborators || []);
25036
+ if (remoteUrl2 && repoPath) {
25037
+ const cleaned = remoteUrl2.replace("https://github.com/", "").replace(/\.git$/, "");
25038
+ saveMapping(cleaned, repoPath);
25039
+ }
25040
+ } catch (e) {
25041
+ console.error("Failed to fetch collaborators", e);
25042
+ setRepoCollaborators([]);
25043
+ }
25044
+ })();
25038
25045
  } else {
25039
25046
  setPushPermission(true);
25040
25047
  }
@@ -25072,6 +25079,7 @@ function App() {
25072
25079
  }
25073
25080
  } finally {
25074
25081
  setIsRefreshing(false);
25082
+ refreshLockRef.current = false;
25075
25083
  }
25076
25084
  };
25077
25085
  const handleCreateBranchSubmit = async (name, base) => {
@@ -21,7 +21,7 @@
21
21
  href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap"
22
22
  rel="stylesheet"
23
23
  />
24
- <script type="module" crossorigin src="./assets/index-jk_ou_Zp.js"></script>
24
+ <script type="module" crossorigin src="./assets/index-ChfAIvyi.js"></script>
25
25
  <link rel="stylesheet" crossorigin href="./assets/index-BAXzLIAI.css">
26
26
  </head>
27
27
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitxelectron",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "An elegant, completely silent auto-syncing Git client. Works as a desktop app and npm CLI tool.",
5
5
  "main": "./out/main/index.js",
6
6
  "files": [