@sequent-org/moodboard 1.4.69 → 1.4.70

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sequent-org/moodboard",
3
- "version": "1.4.69",
3
+ "version": "1.4.70",
4
4
  "type": "module",
5
5
  "description": "Interactive moodboard",
6
6
  "main": "./src/index.js",
@@ -61,6 +61,10 @@ export async function wireCommentsSubsystem(board) {
61
61
 
62
62
  try {
63
63
  await board.commentService.loadInitial();
64
+ // Экземпляр мог быть уничтожен (destroy() при переключении вкладки/повторном
65
+ // открытии), пока висел медленный запрос комментариев. Тогда coreMoodboard и
66
+ // слои уже обнулены — не трогаем их, иначе обращение к null рушит init.
67
+ if (board.destroyed) return;
64
68
  board.commentPinLayer.rebuild();
65
69
  const initialThreadId = board.options.initialThreadId;
66
70
  if (initialThreadId != null) {
@@ -100,9 +104,15 @@ export async function initializeMoodBoard(board) {
100
104
  board.topbarContainer = topbar;
101
105
 
102
106
  await initCoreMoodBoard(board);
107
+ // Каждый await — окно, в котором destroy() (переключение вкладки/повторное
108
+ // открытие) обнуляет coreMoodboard. После await проверяем флаг и прекращаем
109
+ // инициализацию уничтоженного экземпляра, иначе wireMoodBoardServices/
110
+ // loadExistingBoard падают на чтении свойств null и оставляют пустой контейнер.
111
+ if (board.destroyed) return;
103
112
  createMoodBoardManagers(board);
104
113
  createMoodBoardUi(board);
105
114
  await wireCommentsSubsystem(board);
115
+ if (board.destroyed) return;
106
116
  wireMoodBoardServices(board);
107
117
  bindSaveCallbacks(board);
108
118