Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[preview] Expose the materializePaths function used in the preview package #492

Merged
merged 1 commit into from Jan 16, 2018

Conversation

bjoerge
Copy link
Member

@bjoerge bjoerge commented Jan 15, 2018

This exposes a function for materializing a set of paths on a given value. Useful e.g. when you have a partially fetched document but need to retrieve more of its properties, e.g.:

import {materializePaths} from '@sanity/preview'

const partialDoc = {
  _id: 'abc'
}

materializePaths(partialDoc, ['title', 'publishDate'])
  .subscribe(doc => {
    console.log('Title: %s, publish at: %s', doc.title, doc.publishDate)
  })

@bjoerge bjoerge requested a review from simen January 15, 2018 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant