Files
frontend-app-authoring/src/editors/VideoSelector.jsx
Navin Karkera a52f6d9b94 fix: prevent editor from loading twice before initialization (#1761)
Data from previous editor instance was being processed by current editor
instance and sometimes failed due to mismatch. For example, editing text
editor or any other basic editor after opening an advanced problem like
drag-n-drop crashed. Now the editor is only rendered after the
initialization process is complete.
2025-03-25 20:14:57 -05:00

41 lines
880 B
JavaScript

import React from 'react';
import { useDispatch } from 'react-redux';
import PropTypes from 'prop-types';
import VideoGallery from './containers/VideoGallery';
import * as hooks from './hooks';
const VideoSelector = ({
blockId,
learningContextId,
lmsEndpointUrl,
studioEndpointUrl,
}) => {
const dispatch = useDispatch();
const loading = hooks.useInitializeApp({
dispatch,
data: {
blockId,
blockType: 'video',
learningContextId,
lmsEndpointUrl,
studioEndpointUrl,
},
});
// istanbul ignore if
if (loading) {
return null;
}
return (
<VideoGallery />
);
};
VideoSelector.propTypes = {
blockId: PropTypes.string.isRequired,
learningContextId: PropTypes.string.isRequired,
lmsEndpointUrl: PropTypes.string.isRequired,
studioEndpointUrl: PropTypes.string.isRequired,
};
export default VideoSelector;