Skip to content
Snippets Groups Projects
Commit 5c428df7 authored by Guilherme Gazzo's avatar Guilherme Gazzo
Browse files

regression: fix uikit-playground [2]

parent 51342c3f
No related branches found
No related tags found
No related merge requests found
......@@ -12,9 +12,9 @@ function isILayoutblock(obj: object): obj is IPayload {
const useFormatCodeMirrorValue = (
callback: (
parsedCode: IPayload,
prettierCode: ReturnType<typeof codePrettier>
prettierCode: Awaited<ReturnType<typeof codePrettier>>,
) => void,
changes: ICodeMirrorChanges
changes: ICodeMirrorChanges,
) => {
useEffect(() => {
if (changes?.isDispatch) return;
......@@ -23,8 +23,9 @@ const useFormatCodeMirrorValue = (
const parsedCode = json5.parse(changes.value);
if (!isILayoutblock(parsedCode))
throw new Error('Please enter a valid LayoutBlock');
const prettierCode = codePrettier(changes.value, changes.cursor || 0);
callback(parsedCode, prettierCode);
codePrettier(changes.value, changes.cursor || 0).then((prettierCode) => {
callback(parsedCode, prettierCode);
});
} catch (e) {
// do nothing
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment