Skip to content

Using promises to set the default value in config does not work #958

Closed Answered by Saul-Mirone
abhinandshibu asked this question in Q&A
Discussion options

You must be logged in to vote

Operations in config should be synchronized.

I recheck the code and find out that the async config is also supported. But you should return a promise or use async function.

Editor.make()
  .config(async (ctx) => {
    const defaultValue = await fetchContent();
    ctx.set(defaultValueCtx, defaultValue);
  })

This should work.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@abhinandshibu
Comment options

@Saul-Mirone
Comment options

@abhinandshibu
Comment options

Answer selected by Saul-Mirone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants