Frontmatter
| id | 8064 |
| title | Optimize LivePreview Renderer Loading & Lifecycle |
| state | Closed |
| labels | enhancementairefactoringarchitecture |
| assignees | tobiu |
| createdAt | Dec 9, 2025, 2:16 AM |
| updatedAt | Dec 9, 2025, 2:18 AM |
| githubUrl | https://github.com/neomjs/neo/issues/8064 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Dec 9, 2025, 2:17 AM |
Optimize LivePreview Renderer Loading & Lifecycle
tobiu assigned to @tobiu on Dec 9, 2025, 2:16 AM
tobiu closed this issue on Dec 9, 2025, 2:17 AM

tobiu
Dec 9, 2025, 2:18 AM
Input from Gemini:
✦ Refactoring complete.
Changes:
- Optimization: Implemented
rendererscache inLivePreview.mjsto avoid redundant imports.loadRenderer: Added method for efficient dynamic loading and caching.- Initialization: Updated
initAsyncto await initial renderer load.- Lifecycle: Updated
afterSetLanguageto handle runtime changes only.- Robustness: Added
&& this.valuecheck inafterSetRendererto prevent execution on empty values.- Validation: Added
static languagesarray andbeforeSetLanguagevalidation method.Verified code changes.
Optimize the renderer loading mechanism in
Neo.code.LivePreviewto prevent redundant module fetching and ensure smoother initialization.Changes:
renderersobject to cache instantiated renderers.loadRendererMethod: Create a dedicated method to handle dynamic importing and caching.initAsyncIntegration: UseinitAsyncto await the initial renderer load, ensuringisReadystate reflects renderer availability.afterSetLanguage: Update to only triggerloadRendereron runtime changes (whenoldValueexists).afterSetRendererto only triggerdoRunSourceifthis.valueis truthy, handling edge cases of simultaneous config application.static languages = ['markdown', 'neomjs'].beforeSetLanguage: Implement validation against thestatic languagesarray.Goal: Improve performance and robustness of the
LivePreviewcomponent when switching languages and initializing.