Skip to content
Permalink
Browse files

fix: a Story that is separate not to import fromFlow if it doesn't ha…

…ve stories inside and a few edge cases related to timing issues (hacked for now)
  • Loading branch information...
dariocravero committed Jul 24, 2019
1 parent 49d9718 commit 3042c8f5fa73c839dfa6c4554dd8442935a3c6ab
Showing with 12 additions and 6 deletions.
  1. +2 −2 ensure-flow.js
  2. +1 −1 morph/react-dom.js
  3. +1 −1 morph/react-native.js
  4. +1 −1 morph/react/get-body.js
  5. +6 −0 morph/react/make-get-import.js
  6. +1 −1 package.json
@@ -31,7 +31,7 @@ let makeFlow = ({ tools, viewsById, viewsToFiles }) => {
let flowMapStr = []

for (let view of viewsToFiles.values()) {
if (view.custom || !view.parsed.view.isStory) continue
if (!view || view.custom || !view.parsed.view.isStory) continue

let states = []
for (let id of view.parsed.view.views) {
@@ -42,7 +42,7 @@ let makeFlow = ({ tools, viewsById, viewsToFiles }) => {
viewsToFiles,
})

if (!viewInView.custom && viewInView.parsed.view.isStory) {
if (viewInView && !viewInView.custom && viewInView.parsed.view.isStory) {
states.push(viewInView.parsed.view.pathToStory) // `${pathToViewId}/${id}`)
}
}
@@ -60,7 +60,7 @@ export default ({
viewsToFiles,
})

return !viewInView.custom && viewInView.parsed.view.isStory
return viewInView && !viewInView.custom && viewInView.parsed.view.isStory
},
lazy: {},
local,
@@ -58,7 +58,7 @@ export default ({
viewsToFiles,
})

return !viewInView.custom && viewInView.parsed.view.isStory
return viewInView && !viewInView.custom && viewInView.parsed.view.isStory
},
lazy: {},
local,
@@ -65,7 +65,7 @@ export default ({ state, name }) => {
}

let flow = []
if (state.flow === 'separate') {
if (state.flow === 'separate' && state.uses.includes('ViewsUseFlow')) {
flow.push(`let flow = fromFlow.useFlow()`)
}
if (state.setFlow) {
@@ -26,6 +26,12 @@ export default function makeGetImport({
viewsById,
viewsToFiles,
})
if (!importView) {
throw new Error(
`Import "${id}" doesn't exist. It's being imported from ${view.id}.`
)
}

let importFile = importView.file

if (importView.logic) {
@@ -1,6 +1,6 @@
{
"name": "@viewstools/morph",
"version": "19.6.9",
"version": "19.6.10",
"description": "Views language morpher",
"main": "index.js",
"type": "module",

0 comments on commit 3042c8f

Please sign in to comment.
You can’t perform that action at this time.