`contextmenu.ts` eagerly instantiated its model at import time, which
triggered constructor side effects (`getApi()`) too early. This change
aligns ContextMenuModel with the `client-model.ts` singleton pattern so
initialization is explicit and deferred.
- **Singleton pattern migration (`frontend/app/store/contextmenu.ts`)**
- Replaced eager module-level instance creation with a class-based
singleton:
- `private constructor()`
- `static getInstance()`
- Removed `ContextMenuModelType` export and now export
`ContextMenuModel` class only.
- Constructor side effects (`onContextMenuClick` wiring) now run only on
first `getInstance()` call.
- **Usage updates (all context menu entry points)**
- Updated all direct static-style calls:
- `ContextMenuModel.showContextMenu(...)`
- ⟶ `ContextMenuModel.getInstance().showContextMenu(...)`
- Applied across app/builder/preview/term/tab/widget context-menu
handlers to keep behavior consistent while deferring initialization.
- **Focused regression test**
- Added `frontend/app/store/contextmenu.test.ts` to verify:
- importing `contextmenu` does not initialize the API binding;
- first `getInstance()` initializes once;
- repeated `getInstance()` returns the same singleton instance.
```ts
// before
ContextMenuModel.showContextMenu(menu, e);
// after
ContextMenuModel.getInstance().showContextMenu(menu, 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] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sawka <2722291+sawka@users.noreply.github.com>
Working on bug fixes and UX. Streams restarting, fixed lots of bugs,
timing issues, concurrency bugs. Get status shipped to the FE to drive
"shield" state display. Deal with stale streams.
Also big UX changes to the block headers. Specialize the terminal
headers to prioritize the connection (sense of place), remove old
terminal icon and word "Terminal" from the header. Also drop "Web" and
"Preview" labels on web/preview blocks.
Added `wsh focusblock` command.
* Kebab Menu + Switch App Functionality
* Updated Secrets Tab (still more to do, but closer)
* Better Error Handling (Switch to Secrets Tab)
* Add AppInit functionality to Tsunami (fixes initialization issues and
races with embedded assets, and error handling)
* Tsunami - ListStaticFiles
* Tsunami - More Robust Manifest generation (even when there are extra
stdout messages)
* load manifest metadata into the FE
* builder only edits draft/ apps (convert local => draft)
* gofmt app.go after saving (AI tools and manual user save)
* dont open duplicate builder windows
* remix app context menu in waveapp
* add icon/iconcolor in appmeta and implement in the wave block frame
* build manifest
* working on secrets injection (secretstore + secret-bindings.json)
* tool progress indicators
* build output and errors injected as the result of the edit calls so AI
gets instant feedback on edits
* change edits to not be atomic (allows AI to make better progress)
* updated binary location for waveapps
* publish button
* new partial json parser (for sending incremental tool progress
indication)
* updated tsunami view to use new embedded scaffold + config vars
* lots of work on cleaning up the output so it is more useful to users +
AI agents
* fix builder init flow
Got preview hooked up, log output hooked up, environment tab hooked
up... the controller, restarting the apps. it is actually working! still
lots to do and lots of hard coding to fix, but it is coming together...