Q185: switching company carries no focus, search or form from the previous company

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-10-09 07:51:39 -04:00
1 parent 72cf57ce3a
commit f5526b075c
3 files changed
+47 -3

No files matched your search

+4 -2
View File
@@ -29,7 +29,8 @@ const isRoute = oneOf(ROUTE_IDS);
export function App() {
const { snapshot, syncFailure, actions } = useSnapshot();
const [routeChoice, setRoute] = useState<RouteId | null>(null);
const [focus, setFocus] = useState<Focus | null>(null);
// A focus belongs to the company it was opened in; another company's page never receives it.
const [focusChoice, setFocus] = useState<{ orgId: string | null; focus: Focus } | null>(null);
// Leaving a page with input that would be lost asks first.
const [leaving, setLeaving] = useState<{ proceed: () => void } | null>(null);
const requestLeave = (proceed: () => void) => {
@@ -40,7 +41,7 @@ export function App() {
const navigate = (next: RouteId, nextFocus?: Focus) => requestLeave(() => {
setRoute(next);
writeViewState("route", next);
setFocus(nextFocus ?? null);
setFocus(nextFocus ? { orgId: snapshot?.activeOrgId ?? null, focus: nextFocus } : null);
});
const avatarDirectory = useMemo(() => {
// Scope the directory to the active organization: names are only unique
@@ -97,6 +98,7 @@ export function App() {
);
}
const focus = focusChoice && focusChoice.orgId === snapshot.activeOrgId ? focusChoice.focus : null;
const pageProps = { snapshot, actions, navigate, focus };
const page = {
home: <HomePage {...pageProps} />,
+2 -1
View File
@@ -123,7 +123,7 @@ export function Shell({
</button>
</div>
</aside>
{profileOpen && <ProfileDialog employee={employee} onClose={() => setProfileOpen(false)} />}
{profileOpen && <ProfileDialog key={employee.id} employee={employee} onClose={() => setProfileOpen(false)} />}
<main className="main">
<header className="topbar">
<span className="crumb-sub">{organization.name}</span>
@@ -159,6 +159,7 @@ export function Shell({
</div>
</main>
<SearchDialog
key={snapshot.activeOrgId ?? "none"}
snapshot={snapshot}
open={searchOpen}
onClose={() => setSearchOpen(false)}