mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
Contract source code: the code for the empty contract is not displaye… (#2569)
Contract source code: the code for the empty contract is not displayed because of a JS crash Fixes #2568
This commit is contained in:
@@ -252,7 +252,7 @@ const CodeEditor = ({ data, remappings, libraries, language, mainFile, contractN
|
||||
}), [ editorWidth, themeColors, borderRadius ]);
|
||||
|
||||
const renderErrorScreen = React.useCallback(() => {
|
||||
return <Center bgColor={ themeColors['editor.background'] } w="100%" borderRadius="md">Oops! Something went wrong!</Center>;
|
||||
return <Center bgColor={ themeColors['editor.background'] } w="100%" h="100%" borderRadius="md">Oops! Something went wrong!</Center>;
|
||||
}, [ themeColors ]);
|
||||
|
||||
if (data.length === 1) {
|
||||
|
||||
@@ -47,7 +47,7 @@ export default function addMainContractCodeDecoration(model: monaco.editor.IText
|
||||
.findMatches(`^\\}`, lastLineRange, true, false, null, true)
|
||||
.sort(sortByEndLineNumberAsc);
|
||||
|
||||
const restDecoration: monaco.editor.IModelDeltaDecoration = {
|
||||
const restDecoration: monaco.editor.IModelDeltaDecoration | undefined = lastLineMatch ? {
|
||||
range: {
|
||||
startLineNumber: firstLineMatch.range.startLineNumber + 1,
|
||||
endLineNumber: lastLineMatch.range.startLineNumber,
|
||||
@@ -59,8 +59,8 @@ export default function addMainContractCodeDecoration(model: monaco.editor.IText
|
||||
className: '.main-contract-body',
|
||||
marginClassName: '.main-contract-body',
|
||||
},
|
||||
};
|
||||
} : undefined;
|
||||
|
||||
editor.updateOptions({ glyphMargin: true });
|
||||
model.deltaDecorations([], [ firstLineDecoration, restDecoration ]);
|
||||
model.deltaDecorations([], [ firstLineDecoration, restDecoration ].filter(Boolean));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user