Begin PreviewEnv narrowing for the preview widget#3065
Conversation
Co-authored-by: sawka <2722291+sawka@users.noreply.github.com>
Deploying waveterm with
|
| Latest commit: |
813fe7a
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://682bc1ca.waveterm.pages.dev |
| Branch Preview URL: | https://copilot-waveenv-narrowing-pr.waveterm.pages.dev |
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (5 files)
This PR is a clean refactoring that introduces the |
There was a problem hiding this comment.
Code Review Summary
Status: No Issues Found | Recommendation: Merge
Files Reviewed (5 files)
frontend/app/view/preview/preview-directory-utils.tsx- Refactored to use model.envfrontend/app/view/preview/preview-directory.tsx- Added useWaveEnv hookfrontend/app/view/preview/preview-model.tsx- Added env property, updated constructorfrontend/app/view/preview/preview.tsx- Added useWaveEnv hookfrontend/app/view/preview/previewenv.ts- New type definition
This PR is a clean refactoring that introduces the PreviewEnv WaveEnv narrowing type for the preview view. The changes follow the established pattern used by other WaveEnvSubset types in the codebase (TabBarEnv, BlockEnv, BadgeEnv, etc.). All RPC calls and global atoms have been properly migrated to use the env context.
This starts the WaveEnv narrowing work for the preview widget, focused on wiring the preview view tree to the environment surface it already uses today. The change intentionally avoids adding new mock behavior and instead codifies the existing preview dependencies so the widget can move toward the same env-contract pattern used elsewhere.
Preview env contract
PreviewEnvinfrontend/app/view/preview/previewenv.tsObjectServicefullConfigAtomPreview model wiring
PreviewModelto retain and use the injectedwaveEnvinstead of reaching directly for global RPC/service helpers where the env already provides equivalentsenv.rpc,env.services,env.wos, and env-provided atom helpers without changing behaviorPreview component adoption
useWaveEnv<PreviewEnv>()for suggestion fetch/dispose callsPreview-server compatibility
PreviewEnvExample of the new pattern:
Existing preview-server UI used for manual verification:
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.