Skip to content

Commit

Permalink
Possibly resolve sidebar render issues
Browse files Browse the repository at this point in the history
May fix #469
  • Loading branch information
cwegrzyn committed Oct 31, 2024
1 parent 2afc19f commit 2982245
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
import { IronVaultPluginSettings } from "settings";
import { IronVaultPluginLocalSettings } from "settings/local";
import registerSidebarBlocks from "sidebar/sidebar-block";
import { SidebarView, VIEW_TYPE } from "sidebar/sidebar-view";
import { SIDEBAR_VIEW_TYPE, SidebarView } from "sidebar/sidebar-view";
import { TrackedEntities } from "te/index-interface";
import { ProgressIndex, ProgressIndexer } from "tracks/indexer";
import registerTrackBlock from "tracks/track-block";
Expand Down Expand Up @@ -149,7 +149,7 @@ export default class IronVaultPlugin extends Plugin implements TrackedEntities {
this.register(() => delete window.IronVaultAPI);
installLinkHandler(this);

this.registerView(VIEW_TYPE, (leaf) => new SidebarView(leaf, this));
this.registerView(SIDEBAR_VIEW_TYPE, (leaf) => new SidebarView(leaf, this));
this.registerView(LINK_VIEW, (leaf) => new IronVaultLinkView(leaf));
this.registerView(
MIGRATION_VIEW_TYPE,
Expand Down Expand Up @@ -232,12 +232,12 @@ export default class IronVaultPlugin extends Plugin implements TrackedEntities {
}

async initLeaf() {
for (const leaf of this.app.workspace.getLeavesOfType(VIEW_TYPE)) {
for (const leaf of this.app.workspace.getLeavesOfType(SIDEBAR_VIEW_TYPE)) {
return leaf;
}
const leaf = this.app.workspace.getRightLeaf(false);
await leaf?.setViewState({
type: VIEW_TYPE,
type: SIDEBAR_VIEW_TYPE,
});
return leaf;
}
Expand Down
4 changes: 2 additions & 2 deletions src/sidebar/sidebar-block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class ActiveCampaignWatch extends BaseCampaignSource {
);

if (this.campaignManager.lastActiveCampaign()) {
this.update();
setTimeout(() => this.update());
}
}

Expand Down Expand Up @@ -121,7 +121,7 @@ export class FileBasedCampaignWatch extends BaseCampaignSource {
);
this.#campaign = campaign ?? undefined;
this.#unsub = unsubscribe;
this.update();
setTimeout(() => this.update());
}

onunload(): void {
Expand Down
4 changes: 2 additions & 2 deletions src/sidebar/sidebar-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import renderIronVaultMoves from "./moves";
import renderIronVaultOracles from "./oracles";
import { ActiveCampaignWatch } from "./sidebar-block";

export const VIEW_TYPE = "iron-vault-sidebar-view";
export const SIDEBAR_VIEW_TYPE = "iron-vault-sidebar-view";

export class SidebarView extends ItemView {
plugin: IronVaultPlugin;
Expand All @@ -22,7 +22,7 @@ export class SidebarView extends ItemView {
}

getViewType() {
return VIEW_TYPE;
return SIDEBAR_VIEW_TYPE;
}

getDisplayText() {
Expand Down

0 comments on commit 2982245

Please sign in to comment.