@lvce-editor/main-area-worker 9.68.0 → 9.68.1
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.
- package/dist/mainAreaWorkerMain.js +17 -3
- package/package.json +1 -1
|
@@ -1926,7 +1926,15 @@ const wrapSerialCommand = fn => {
|
|
|
1926
1926
|
const state$1 = {
|
|
1927
1927
|
configured: false,
|
|
1928
1928
|
lastId: -1,
|
|
1929
|
-
nextId: 0
|
|
1929
|
+
nextId: 0,
|
|
1930
|
+
reservedIds: new Set()
|
|
1931
|
+
};
|
|
1932
|
+
const reserve = ids => {
|
|
1933
|
+
for (const id of ids) {
|
|
1934
|
+
if (id >= state$1.nextId && id <= state$1.lastId) {
|
|
1935
|
+
state$1.reservedIds.add(id);
|
|
1936
|
+
}
|
|
1937
|
+
}
|
|
1930
1938
|
};
|
|
1931
1939
|
const configure = (start, end) => {
|
|
1932
1940
|
const {
|
|
@@ -1946,13 +1954,16 @@ const create$2 = () => {
|
|
|
1946
1954
|
const {
|
|
1947
1955
|
configured,
|
|
1948
1956
|
lastId,
|
|
1949
|
-
|
|
1957
|
+
reservedIds
|
|
1950
1958
|
} = state$1;
|
|
1951
1959
|
if (!configured) {
|
|
1952
1960
|
// Compatibility with renderer versions that do not assign worker id ranges.
|
|
1953
1961
|
return Math.random();
|
|
1954
1962
|
}
|
|
1955
|
-
|
|
1963
|
+
while (reservedIds.delete(state$1.nextId)) {
|
|
1964
|
+
state$1.nextId++;
|
|
1965
|
+
}
|
|
1966
|
+
if (state$1.nextId > lastId) {
|
|
1956
1967
|
throw new Error('Component id range exhausted');
|
|
1957
1968
|
}
|
|
1958
1969
|
return state$1.nextId++;
|
|
@@ -7864,6 +7875,9 @@ const updateTabs = (state, editorUids) => {
|
|
|
7864
7875
|
};
|
|
7865
7876
|
|
|
7866
7877
|
const restoreAndCreateEditors = async (state, restoredLayout) => {
|
|
7878
|
+
// Saved tab/group IDs can overlap the range assigned to a fresh renderer.
|
|
7879
|
+
// Reserve them before creating editors or opening any additional tabs.
|
|
7880
|
+
reserve(restoredLayout.groups.flatMap(group => [group.id, ...group.tabs.map(tab => tab.id)]));
|
|
7867
7881
|
let newState = {
|
|
7868
7882
|
...state,
|
|
7869
7883
|
layout: restoredLayout
|