Skip to content

Commit

Permalink
githubsettings: debounce cred-check
Browse files Browse the repository at this point in the history
  • Loading branch information
julesvirallinen committed Sep 27, 2023
1 parent 1ec5236 commit 949f50e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/ui/SettingsView/GithubSettings.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Setting } from "obsidian";
import { Setting, debounce } from "obsidian";
import SettingView from "./SettingView";
import { Octokit } from "@octokit/core";

Expand Down Expand Up @@ -40,7 +40,7 @@ export class GithubSettings {

checkConnectionAndSaveSettings = async () => {
this.settings.saveSettings();
await this.updateConnectionStatus();
this.debouncedUpdateConnectionStatus();
};

updateConnectionStatus = async () => {
Expand Down Expand Up @@ -68,6 +68,12 @@ export class GithubSettings {
this.updateConnectionStatusIndicator();
};

debouncedUpdateConnectionStatus = debounce(
this.updateConnectionStatus,
500,
true,
);

updateConnectionStatusIndicator = () => {
if (this.connectionStatus === "loading") {
this.connectionStatusElement.innerText = "⏳";
Expand Down

0 comments on commit 949f50e

Please sign in to comment.