Skip to content

Commit

Permalink
githubsettings: debounce cred-check (#434)
Browse files Browse the repository at this point in the history
  • Loading branch information
julesvirallinen authored Sep 30, 2023
1 parent 9dac3cb commit 577524d
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 577524d

Please sign in to comment.