You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refine global atom split: keep atom init in global-atoms.ts, move About-menu wiring back to global.ts (#2900)
This refactor keeps `global-atoms.ts` as the owner of atom
state/initialization while correcting ownership boundaries for UI/event
wiring. Specifically, the About menu handler was moved out of atom
initialization and back into `global.ts` startup orchestration.
- **Context / intent**
- `global-atoms.ts` should own atom construction and registries only.
- `global.ts` should orchestrate app-level startup side effects and
re-export compatibility APIs.
- **What changed**
- **`global-atoms.ts`**
- Removed `onMenuItemAbout` registration from `initGlobalAtoms`.
- Removed `modalsModel` import (no longer needed; improves layering).
- Continued to own atom state (`atoms`), atom init (`initGlobalAtoms`),
and atom registries/caches.
- **`global.ts`**
- Added `onMenuItemAbout` registration to `initGlobal` immediately after
`initGlobalAtoms(initOpts)`.
- Keeps UI-level event wiring with global startup orchestration.
- **Boundary after this change**
- `global-atoms.ts`: atom ownership + atom graph init.
- `global.ts`: runtime orchestration + menu/event side effects +
compatibility re-exports.
```ts
// global.ts
function initGlobal(initOpts: GlobalInitOptions) {
globalEnvironment = initOpts.environment;
globalPrimaryTabStartup = initOpts.primaryTabStartup ?? false;
setPlatform(initOpts.platform);
initGlobalAtoms(initOpts);
try {
getApi().onMenuItemAbout(() => {
modalsModel.pushModal("AboutModal");
});
} catch (e) {
console.log("failed to initialize onMenuItemAbout handler", e);
}
}
```
<!-- START COPILOT CODING AGENT TIPS -->
---
💡 You can make Copilot smarter by setting up custom instructions,
customizing its development environment and configuring Model Context
Protocol (MCP) servers. Learn more [Copilot coding agent
tips](https://gh.io/copilot-coding-agent-tips) in the docs.
---------
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: sawka <[email protected]>
0 commit comments