Resolve relations with Storyblok Bridge

Changes in: app Permalink

It's now possible to resolve relations with the live updates from the input event of the Storyblok Javascript bridge.

If you call the function resolveRelations the relations provided as second argument will be solved.

How to use?

Call storyblok.resolveRelations(storyObject, relationsToResolve, callbackWhenResolved) in callback of the input event after the addComments function.

Example

Javascriptconst sb = window.storyblok

sb.on('input', (data) => {
  sb.addComments(data.story.content, data.story.id)
  sb.resolveRelations(data.story, ['blog.author', 'blog.categories'], () => {
    // data.story.content has now the resolved relations
    // this.content = data.story.content
  })
})