Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const Editor = ({ api }: { api: API }) => {
const emit = useChannel({});
const story = useCurrentStory();
const storyId = story && story.id ? story.id : '';
const [initialCode, setInitialCode] = useEditor();
const [metaData, setMetadata] = React.useState(null);
let previousSource = '';
const loadStoryCode = (sourceLoader: SourceLoaderInfo) => {
const sourceCode = sourceLoader.edition.source;
setMetadata(sourceLoader);
if (previousSource === sourceCode || initialCode[storyId]) {
return null;
}
previousSource = sourceCode;
const sourceSplitted = sourceCode.split('\n');
if (sourceLoader.location) {