From df3f8ca9e555c9765bd50bfca4e140eb9094fce8 Mon Sep 17 00:00:00 2001 From: Vladislav Makhov Date: Fri, 2 Apr 2021 11:16:01 +0300 Subject: [PATCH] web: files: fix MediaViewerDataStore accesses --- .../Client/src/store/MediaViewerDataStore.js | 12 +++++++----- products/ASC.Files/Client/src/store/index.js | 3 ++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/products/ASC.Files/Client/src/store/MediaViewerDataStore.js b/products/ASC.Files/Client/src/store/MediaViewerDataStore.js index 92b890578f..06d0b3380c 100644 --- a/products/ASC.Files/Client/src/store/MediaViewerDataStore.js +++ b/products/ASC.Files/Client/src/store/MediaViewerDataStore.js @@ -1,12 +1,14 @@ import { makeAutoObservable } from "mobx"; -import filesStore from "./FilesStore"; class MediaViewerDataStore { + filesStore; + id = null; visible = false; - constructor() { + constructor(filesStore) { makeAutoObservable(this); + this.filesStore = filesStore; } setMediaViewerData = (mediaData) => { @@ -18,8 +20,8 @@ class MediaViewerDataStore { const playlist = []; let id = 0; - if (filesStore.filesList) { - filesStore.filesList.forEach((file) => { + if (this.filesStore.filesList) { + this.filesStore.filesList.forEach((file) => { if (file.canOpenPlayer) { playlist.push({ id: id, @@ -35,4 +37,4 @@ class MediaViewerDataStore { } } -export default new MediaViewerDataStore(); +export default MediaViewerDataStore; diff --git a/products/ASC.Files/Client/src/store/index.js b/products/ASC.Files/Client/src/store/index.js index 350e82c34c..8da993c143 100644 --- a/products/ASC.Files/Client/src/store/index.js +++ b/products/ASC.Files/Client/src/store/index.js @@ -10,8 +10,8 @@ import FormatsStore from "./FormatsStore"; import iconFormatsStore from "./IconFormatsStore"; import mediaViewersFormatsStore from "./MediaViewersFormatsStore"; import docserviceStore from "./DocserviceStore"; +import MediaViewerDataStore from "./MediaViewerDataStore"; -import mediaViewerDataStore from "./MediaViewerDataStore"; import versionHistoryStore from "./VersionHistoryStore"; import uploadDataStore from "./UploadDataStore"; import dialogsStore from "./DialogsStore"; @@ -48,6 +48,7 @@ const formatsStore = new FormatsStore( mediaViewersFormatsStore, docserviceStore ); +const mediaViewerDataStore = new MediaViewerDataStore(filesStore); const stores = { initFilesStore,