@lvce-editor/main-area-worker 9.37.4 → 9.37.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1962,7 +1962,7 @@ const handleAttach = async command => {
1962
1962
  await invoke('Layout.attachViewlet', parentNodeSelector, command.instanceId);
1963
1963
  };
1964
1964
 
1965
- const getTitle$1 = async editorUid => {
1965
+ const getViewletTitle = async editorUid => {
1966
1966
  try {
1967
1967
  const title = await invoke('Viewlet.getTitle', editorUid);
1968
1968
  return typeof title === 'string' && title ? title : undefined;
@@ -1970,13 +1970,16 @@ const getTitle$1 = async editorUid => {
1970
1970
  return undefined;
1971
1971
  }
1972
1972
  };
1973
- const createViewlet = async (viewletModuleId, editorUid, tabId, bounds, uri, args) => {
1973
+ const createViewletContent = async (viewletModuleId, editorUid, tabId, bounds, uri, args) => {
1974
1974
  if (args === undefined) {
1975
1975
  await invoke('Layout.createViewlet', viewletModuleId, editorUid, tabId, bounds, uri);
1976
1976
  } else {
1977
1977
  await invoke('Layout.createViewlet', viewletModuleId, editorUid, tabId, bounds, uri, args);
1978
1978
  }
1979
- return getTitle$1(editorUid);
1979
+ };
1980
+ const createViewlet = async (viewletModuleId, editorUid, tabId, bounds, uri, args) => {
1981
+ await createViewletContent(viewletModuleId, editorUid, tabId, bounds, uri, args);
1982
+ return getViewletTitle(editorUid);
1980
1983
  };
1981
1984
 
1982
1985
  const getActiveFileUri = state => {
@@ -4208,6 +4211,13 @@ const updateTabIcon = async (context, readyState, tabId) => {
4208
4211
  }
4209
4212
  };
4210
4213
 
4214
+ const renderMainAreaPending = async uid => {
4215
+ try {
4216
+ await invoke('Layout.renderMainAreaPending', uid);
4217
+ } catch {
4218
+ // Older renderer workers render the final state when openInput completes.
4219
+ }
4220
+ };
4211
4221
  const getExistingTabState = (state, existingTab, preview) => {
4212
4222
  const focusedState = focusEditorGroup(state, existingTab.groupId);
4213
4223
  const pinnedState = !preview && existingTab.tab.isPreview ? updateTab(focusedState, existingTab.tab.id, {
@@ -4299,10 +4309,16 @@ const openInputWithContext = async (context, options) => {
4299
4309
  if (editorUid === -1) {
4300
4310
  throw new Error('invalid editorUid');
4301
4311
  }
4302
- const renderedTitle = await createViewlet(viewletModuleId, editorUid, tabId, bounds, uri, options.args);
4312
+ await createViewletContent(viewletModuleId, editorUid, tabId, bounds, uri, options.args);
4303
4313
  const latestState = context.getState();
4304
- const readyState = handleViewletReady(latestState, editorUid, renderedTitle);
4314
+ let readyState = handleViewletReady(latestState, editorUid);
4305
4315
  await context.updateState(() => readyState);
4316
+ await renderMainAreaPending(state.uid);
4317
+ const renderedTitle = await getViewletTitle(editorUid);
4318
+ if (renderedTitle) {
4319
+ readyState = handleViewletReady(context.getState(), editorUid, renderedTitle);
4320
+ await context.updateState(() => readyState);
4321
+ }
4306
4322
  const stateWithIcon = await updateTabIcon(context, readyState, tabId);
4307
4323
  if (stateWithIcon) {
4308
4324
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/main-area-worker",
3
- "version": "9.37.4",
3
+ "version": "9.37.5",
4
4
  "description": "Main Area Worker",
5
5
  "repository": {
6
6
  "type": "git",