Public: anyone can read this; the crew can change it.

The Dependencies screen is busy until its report is read, so a and f are never dropped #17524

opened this

Merged 18h ago, live in production

fix/dep-accept-keys → main 0 commits

  • Merged. fix/dep-accept-keys was merged into main as 0d18300.

Review

Sign in to review this change.
1 file changed +11 −4
src/tui/screens/dependencies.ts +11 −4
@@ -56,12 +56,19 @@ export function dependenciesScreen(f: Session, ctx: Ctx, repo: Repo): Screen {
5656 report = fresh && withAcceptances(f.app.db, repo.id, fresh);
5757 note = report === undefined ? "No such branch." : report.findings.length === 0 ? `No known advisory in ${report.packages} pinned packages.` : `${report.findings.length} findings in ${report.packages} pinned packages.`;
5858 };
59 const again = (): void => void read().catch(() => (note = "The lockfiles could not be read.")).finally(() => ctx.invalidate());
59 // The read is awaited by `load` and tracked on R, so the app is busy until the report is in: a
60 // key pressed before it (a, f) is not dropped on a screen with nothing to act on yet.
61 const again = (): Promise<void> =>
62 read()
63 .catch(() => {
64 note = "The lockfiles could not be read.";
65 })
66 .finally(() => ctx.invalidate());
6067 const screen: Screen = {
6168 title: `${repo.ownerName}/${repo.name} — Dependencies`,
6269 keys: [binding(["j", "k"], "move cursor"), binding([keyOf("reread")], "read again"), binding(["a"], "accept the risk"), binding(["f"], "file the fix")],
6370 async load() {
64 again();
71 await again();
6572 },
6673 render(area, s) {
6774 const c = ctx.theme.c;
@@ -73,7 +80,7 @@ export function dependenciesScreen(f: Session, ctx: Ctx, repo: Repo): Screen {
7380 if (state.key(e, report?.findings.length ?? 0)) return true;
7481 if (e.ctrl || e.alt) return false;
7582 if (e.key === keyOf("reread")) {
76 again();
83 void ctx.track(again());
7784 return true;
7885 }
7986 const row = report?.findings[state.index];
@@ -93,7 +100,7 @@ export function dependenciesScreen(f: Session, ctx: Ctx, repo: Repo): Screen {
93100 onSubmit: (reason) => {
94101 const done = acceptAdvisory(f.app, repo, f.user, held, { package: row.package, version: row.version, advisory: row.advisory, reason });
95102 if (!done.ok) return done.why;
96 return Promise.resolve().then(() => again());
103 return Promise.resolve().then(() => void ctx.track(again()));
97104 },
98105 }),
99106 );

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs