Conversation
…ever been loaded When a new executable file (.gts/.ts/.js/.gjs) is written to a realm, skip the expensive loader reset if the module was never imported. This prevents unnecessary full UI refreshes in notebook-style workflows where AI writes new code files sequentially. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e987bbdc2c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
This PR reduces unnecessary UI refreshes by avoiding loader resets when executable files change but their corresponding modules have never been loaded in the current session (CS-10474).
Changes:
- Added
Loader.isModuleLoaded()to detect whether a module is present in the loader’s internal module cache. - Updated invalidation handling and write paths to only reset/flush the loader when the changed executable module is already loaded.
- Added unit tests covering
isModuleLoaded()behavior for direct imports, dependencies, executable extensions, and re-exports.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/runtime-common/loader.ts | Adds isModuleLoaded() API used to gate loader resets. |
| packages/host/tests/unit/loader-test.ts | Adds unit tests for the new loader API. |
| packages/host/app/services/store.ts | Avoids loader reset on executable invalidations for modules not already loaded. |
| packages/host/app/services/card-service.ts | Only resets loader on save when the saved module was already loaded. |
| packages/host/app/resources/file.ts | Only refreshes references for code change when the written module was already loaded. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Preview deployments |
- Fix file.ts: capture isModuleLoaded BEFORE saveSource (which may reset the loader), so the check sees the pre-reset loader state - Fix store.ts: use wasModuleLoaded() which checks both current and previous loader, handling the timing window where the save path resets the loader before the realm invalidation event arrives - Add previousLoader tracking to LoaderService so module-loaded checks survive across loader resets within the same invalidation cycle - Add try/catch to isModuleLoaded for non-URL identifiers Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
If the current loader has never encountered a module, no card was rendered using it through this loader — there's nothing stale to refresh. When the save path already called resetLoader(), the tracked property change on the loader triggers Ember's reactivity, causing re-renders that use the new loader to import updated code fresh. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
backspace
left a comment
There was a problem hiding this comment.
It would be nice to enforce this with a full-stack test but I don’t know how that would work
Summary
isModuleLoaded()method to theLoaderclass that checks whether a module identifier exists in the internal modules mapstore.ts,card-service.ts, andfile.tsto only trigger a loader reset when the changed executable file's module was already loadedFixes CS-10474
Test plan
isModuleLoaded:.gts,.js, etc.)🤖 Generated with Claude Code