Update desktop app site state when making CLI changes#2799
Conversation
📊 Performance Test ResultsComparing 3f3345f vs trunk app-size
site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff) |
bcotrim
left a comment
There was a problem hiding this comment.
Thanks for the change @nb
I tried, but couldn't replicate the start issue trunk — tested starting a site via CLI both with Studio open and before opening Studio, and both cases showed the correct running state.
Could you share more detailed steps/logs?
The setupDevelopmentExtensions looks great!
|
@bcotrim you're right, I was testing with 1.7.5 where it was broken, but it does to work with |
Sites started outside the desktop app are announced through the CLI\nevents stream as site-updated events. The subscriber only registered\nmissing sites on site-created, so a site started via studio ai or\nstudio site start could be dropped before the renderer ever saw it.\n\nRegister missing sites on updated events too and cover the path with a\nsubscriber regression test.
Electron can fail to start the React and Redux DevTools service worker\nwhen Studio boots in development. That rejection was unhandled, which\nmade npm start noisy even though the app could continue to run.\n\nWrap development extension setup in a guard, log a warning, and keep\nbooting when the worker fails to start.
Unless I am missing something it does change the behavior, from creating sites on Studio app only on CREATED events, to creating sites on Studio app for any received event. |
Reproduce
studio site start --path ~/Studio/<existing-site>How AI was used in this PR
Used Codex to trace the CLI-to-app event flow, identify the missing registration path for externally started sites, and draft the initial code and test changes. I reviewed the final implementation, adjusted the test coverage, and ran the verification commands locally.
Proposed Changes
site-updatedevents from the CLI event subscriber, not only onsite-createdstudio aiandstudio site start, to appear as running in the appTesting Instructions
npm startnpm run cli:buildnode apps/cli/dist/cli/main.js site start --path ~/Studio/<existing-site>npx eslint --fix apps/studio/src/index.ts apps/studio/src/tests/index.test.ts apps/studio/src/modules/cli/lib/cli-events-subscriber.ts apps/studio/src/modules/cli/lib/tests/cli-events-subscriber.test.tsnpm test -- apps/studio/src/tests/index.test.ts apps/studio/src/modules/cli/lib/tests/cli-events-subscriber.test.tsnpm run typecheckPre-merge Checklist