Skip to content

Commit

Permalink
Added null safty check on doc constant
Browse files Browse the repository at this point in the history
  • Loading branch information
Jimmi Jønsson committed May 6, 2022
1 parent 525653b commit d7fd321
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ const contentSyncUrl = process.env.SANITY_STUDIO_CONTENT_SYNC_URL;

export function gatsbyPreviewAction({ published, draft }) {
const doc = draft || published;

if (!doc) return null;

let id;
if (published) {
Expand Down

0 comments on commit d7fd321

Please sign in to comment.