@ogulcancelik/pi-minimal-footer 0.1.0 → 0.1.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.
Files changed (2) hide show
  1. package/index.ts +7 -7
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -835,8 +835,6 @@ export default function (pi: ExtensionAPI) {
835
835
  if (!ctx.hasUI) return;
836
836
 
837
837
  ctx.ui.setFooter((tui: any, theme: any, footerData: any) => {
838
- // Store tui reference for event handlers — must be set before any async
839
- // fetch completes so requestRender() works on first load.
840
838
  tuiRef = tui;
841
839
 
842
840
  const unsub = footerData.onBranchChange(() => {
@@ -844,6 +842,13 @@ export default function (pi: ExtensionAPI) {
844
842
  tui.requestRender();
845
843
  });
846
844
 
845
+ // Initial fetch inside factory — tui is guaranteed available here,
846
+ // so requestRender() will work when the async fetch completes.
847
+ if (ctx.model?.provider) {
848
+ fetchUsage(ctx.model.provider);
849
+ startRefreshTimer();
850
+ }
851
+
847
852
  return {
848
853
  dispose: () => {
849
854
  unsub();
@@ -919,11 +924,6 @@ export default function (pi: ExtensionAPI) {
919
924
  };
920
925
  });
921
926
 
922
- // Initial usage fetch — after setFooter so tuiRef is set
923
- if (ctx.model?.provider) {
924
- fetchUsage(ctx.model.provider);
925
- startRefreshTimer();
926
- }
927
927
  });
928
928
 
929
929
  // Refresh when model changes — fetch immediately, restart timer
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ogulcancelik/pi-minimal-footer",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Minimal footer for pi with context gauge and subscription usage bars",
5
5
  "type": "module",
6
6
  "keywords": [