Skip to content

Commit 6cda2f7

Browse files
committed
fix(blocks): warn if fragment is not exported
1 parent e3ad868 commit 6cda2f7

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

packages/smooth-core/src/client/Blocks.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
import React from 'react'
22
import gql from 'graphql-tag'
33
import {
4+
getFragment,
45
getFragmentDefinition,
56
getFragmentString,
67
getComponent,
78
getDefinitionType,
89
getDefinitionName,
910
} from './util'
1011

11-
function getBlock(filePath, mod) {
12-
const { blockFragment: fragment } = mod
13-
if (!fragment) return null
14-
12+
function getBlock(filePath, exp) {
13+
const fragment = getFragment(exp, 'blockFragment', filePath)
1514
const fragmentDefinition = getFragmentDefinition(fragment)
16-
const Component = getComponent(mod, filePath)
15+
const Component = getComponent(exp, filePath)
1716
const type = getDefinitionType(fragmentDefinition)
1817
const name = getDefinitionName(fragmentDefinition)
1918
const propsAttribute = `${type}_props`

0 commit comments

Comments
 (0)