Skip to content

Commit 4ac6be0

Browse files
authored
fix(app): wait for this host's name and projects before showing a project, and for GitHub before Issues and PRs (#639)
* fix(app): wait for this host's name and projects before showing a project, and for GitHub before Issues and PRs Why: apps/app/src/app.tsx#function App | the project list is built only once hello names this host and its projects frame arrives; earlier, its own channels read as a teammate's * chore: confirm lane notes * lane: sync fix-loading-flash memory * chore: confirm lane notes
1 parent d4d184f commit 4ac6be0

5 files changed

Lines changed: 35 additions & 19 deletions

File tree

‎.lane/memory/apps/app/src/app.tsx/01M4YT6XB7NQ89E6F4P375REE7-all-projects-and-project-vie.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ anchor: function App
44
created: 2026-10-15T03:38:04Z
55
norm: '1'
66
sig: 063d0f00fea02511
7-
body_hash: cf62711c75c66568
8-
raw_hash: 38568af4c890e786
9-
vouched: 2026-10-22T20:27:44Z
7+
body_hash: b0a39d06b7ed2900
8+
raw_hash: 2b2e4ccf7e3ee6f2
9+
vouched: 2026-10-22T20:29:47Z
1010
lines: 235-824
1111
---
1212

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
id: 01M5JMVG9G87F31FGVV571Y6BJ
3+
anchor: function App
4+
created: 2026-10-22T20:29:16Z
5+
norm: '1'
6+
sig: 063d0f00fea02511
7+
body_hash: b0a39d06b7ed2900
8+
raw_hash: 2b2e4ccf7e3ee6f2
9+
vouched: 2026-10-22T20:29:47Z
10+
lines: 330-1237
11+
---
12+
13+
the project list is built only once hello names this host and its projects frame arrives; earlier, its own channels read as a teammate's

‎.lane/memory/apps/host/src/gateway-client.ts/01M4YQRMKVKT45GACS27J2TXWY-channel-listings-must-outliv.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ anchor: class GatewayClient
44
created: 2026-10-15T02:55:20Z
55
norm: '1'
66
sig: 41366b9e88f0e890
7-
body_hash: 37f27c37825b3457
8-
raw_hash: c990e819f8c5c8e5
9-
vouched: 2026-10-22T14:33:27Z
7+
body_hash: f327ecd85b1a1ced
8+
raw_hash: eb40263f67d2ffcb
9+
vouched: 2026-10-22T20:29:22Z
1010
lines: 33-240
1111
---
1212

‎apps/app/src/app.tsx‎

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -444,11 +444,12 @@ export function App() {
444444
host.request<Hello>({ op: "hello" }).then(setHello, () => {});
445445
}, [status]);
446446

447-
const available = useMemo(() => projects(opened, channels, hello.host), [
448-
opened,
449-
channels,
450-
hello.host,
451-
]);
447+
// Until this host names itself and lists its projects, its own channels read as a teammate's.
448+
const loaded = !!opened && !!hello.host;
449+
const available = useMemo(
450+
() => opened && hello.host ? projects(opened, channels, hello.host) : [],
451+
[opened, channels, hello.host],
452+
);
452453
useGithubRefresh(available);
453454
const listings = new Map(channels.map((channel) => [channel.id, channel]));
454455
const byId = useMemo(() => {
@@ -464,9 +465,10 @@ export function App() {
464465
const repo = useGithub<string | null>(
465466
current && { op: "project-repo", project: current.path, host: current.host },
466467
);
467-
// Only a definite answer hides GitHub, so the lists can still say why a lookup failed.
468-
const linked = repo.value !== null;
469-
const page = !linked && (saved === "issues" || saved === "prs") ? "channels" : saved;
468+
// Only a definite answer hides GitHub, so the lists can still say why a lookup failed; Issues and
469+
// PRs appear once the lookup answers either way, so they never show and then vanish.
470+
const linked = !!repo.value || (status === "open" && !!repo.error);
471+
const page = repo.value === null && (saved === "issues" || saved === "prs") ? "channels" : saved;
470472
function go(next: Page) {
471473
if (linked || (next !== "issues" && next !== "prs")) setPage(next);
472474
}
@@ -613,7 +615,7 @@ export function App() {
613615

614616
// Declared, not a const: the picker and All Projects groups above call it during render.
615617
function removable(value: AppProject) {
616-
return connected && opened.some((checkout) => isLocal(checkout, value));
618+
return connected && !!opened?.some((checkout) => isLocal(checkout, value));
617619
}
618620

619621
function remove(value: AppProject) {
@@ -623,7 +625,7 @@ export function App() {
623625

624626
async function forget(value: AppProject) {
625627
try {
626-
for (const checkout of opened.filter((checkout) => isLocal(checkout, value))) {
628+
for (const checkout of opened?.filter((checkout) => isLocal(checkout, value)) || []) {
627629
await host.request({ op: "project-remove", path: checkout.path });
628630
}
629631
} catch (error) {
@@ -872,7 +874,7 @@ export function App() {
872874
page={page}
873875
user={hello.user}
874876
github={people[hello.user]}
875-
repo={linked}
877+
repo={linked || page === "issues" || page === "prs"}
876878
onPage={go}
877879
onSettings={() => setSettings(true)}
878880
/>
@@ -999,7 +1001,7 @@ export function App() {
9991001
<Disconnected />
10001002
</p>
10011003
)}
1002-
{!current && !connected
1004+
{!current && (!connected || !loaded)
10031005
? null
10041006
: !current
10051007
? (

‎apps/host/src/gateway-client.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ export class GatewayClient {
6060
*/
6161
stalled = false;
6262
channels: Listing[] = [];
63-
projects: Project[] = [];
63+
/** Undefined until the host first sends them, so an app can tell loading from having none. */
64+
projects?: Project[];
6465
people: People = {};
6566
/** Asks to join the team waiting for this host's owner; only the local app receives them. */
6667
asks: TeamAsk[] = [];

0 commit comments

Comments
 (0)