Skip to content

Commit

Permalink
regression: fix uikit-playground [2]
Browse files Browse the repository at this point in the history
  • Loading branch information
ggazzo committed Oct 29, 2024
1 parent 51342c3 commit 5c428df
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions apps/uikit-playground/src/hooks/useFormatCodeMirrorValue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
}
Expand Down

0 comments on commit 5c428df

Please sign in to comment.