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

It's look like we can't render a component with children in pending state #8

Closed
ohardy opened this issue Dec 1, 2016 · 5 comments
Closed

Comments

@ohardy
Copy link

ohardy commented Dec 1, 2016

With that:

<Route
        Component={Layout}
        queries={LayoutQueries}
        prepareParams={prepareParamsLayout}
        render={renderLayout}
      >
        <Route
          Component={Content}
          queries={ContentQueries}
          prepareParams={prepareParamsContent}
          render={renderContent}
        />
      </Route>

And a generic render who return a loading component if no Component or props.

I want to render Layout all the time, but actually i receive null Component in renderLayout call of Layout while Content data is loading.

Sorry for my english, I am french ^^

@taion
Copy link
Member

taion commented Dec 1, 2016

You shouldn't be receiving a null component there in any case. Do you have a stack trace/

@ohardy
Copy link
Author

ohardy commented Dec 1, 2016

Not sure it will help ;)

Component is not null after ContentQueries resolved

(anonymous function)	          @	createElements.js?a0af:54
createElements	                @	createElements.js?a0af:24
_callee$	                      @	createResolveElements.js?6f65:166
tryCatch	                      @	runtime.js?1aab:63
invoke	                        @	runtime.js?1aab:337
prototype.(anonymous function)	@	runtime.js?1aab:96
resume	                        @	asyncGenerator.js?4df4:48
(anonymous function)	          @	asyncGenerator.js?4df4:53

@ohardy
Copy link
Author

ohardy commented Dec 1, 2016

Oki, i make a mistake in my example, it's look like that:

<Route
        getComponent={getLayout}
        queries={LayoutQueries}
        prepareParams={prepareParamsLayout}
        render={renderLayout}
      >
        <Route
          Component={Content}
          queries={ContentQueries}
          prepareParams={prepareParamsContent}
          render={renderContent}
        />
      </Route>

I use getComponent for Layout that return a promise, do a direct query to GraphQL server and resolve to component. getComponent is resolved and return a valid Component and after i got null Component in render call. Hope it's help

@taion
Copy link
Member

taion commented Dec 1, 2016

That's the expected behavior – we don't continuously rerender to avoid layout thrashing; we only render once with the data initially available, then again at the end once everything is fetched.

@taion taion closed this as completed Dec 1, 2016
@ohardy
Copy link
Author

ohardy commented Dec 2, 2016

Just to confirm that if i don't return a Promise in getComponent, everything is OK. Just in case, it will be really cool to recall render just when getComponent is resolved (Component pass from null to non null), so we can load part of the UI while loading queries :)

taion added a commit that referenced this issue Mar 19, 2019
f5f341e docs: Fix docs
ad96285 fix: Fix tooling
a6cab23 fix: Various bugfixes (#41)
5c7fb83 chore: Update dependencies (#30)
cc1085a more
5d616b2 chore: Update dependencies
76b9016 Update dependencies
aebfa93 Fix build
e6564fe Update dependencies
e5d1f40 Update dependency
ba4651a Update dependencies
80a966f Fix pattern
6a6abb9 Update dependencies
668f02a Downgrade graphql
57f77eb Merge branch 'found-modern'
4d2f7d8 Update dependencies
e6d4e86 Use Found Relay Modern
8634bba Merge pull request #21 from taion/update-readme
597aeef Add found-modern-universal [ci skip]
6d89772 Use Found Relay Classic
2394893 Merge pull request #20 from taion/update-README
b265b6f Update project naming in README [ci skip]
671f3c2 Merge pull request #19 from taion/update-README
cc249f3 Update README [ci skip]
1a86b11 Merge branch 'master' into found-classic
a15f5a1 Merge pull request #18 from taion/fix-readme
8b1f8a1 Remove wrong note in README
87bb04b Update for Found v0.3.x
317f4c1 Use Found
38a8dcc Merge pull request #17 from taion/upgrade-relay
c7fa52b Upgrade to Relay v1.x (not Relay Modern)
6b062cd Merge pull request #15 from taion/fix-dev-source-map
c690479 Fix dev source map
34ecfea Merge pull request #14 from taion/fix-webpack
59e36ec Fix webpack config
efef591 Merge pull request #13 from taion/fix
1ca22f1 More fixes
a30143f Merge pull request #12 from taion/update
fe44bef Update dependencies
0e4a1fd Merge pull request #11 from alexmcmillan/master
078b6b9 Updating links to official Relay TodoMVC application and license
ddfe02d Merge pull request #9 from taion/passPerPreset
36cb4ac Drop passPerPreset
3ef9ccb Merge pull request #8 from taion/fix-mutations
a8a424e Fix mutations
af2b8bc Merge pull request #7 from taion/update
76c1194 Update everything to newest
76c527a Upgrade react-router-relay
73529e1 Move back to React Router
5a5dcbe Update checked-in schema
d4bba5d Update dependencies and move to rrtr (#6)
edb3dff Update for React Router v2.x
c7d70f6 Actually update the dumped schema
9174561 Fix limit to work with new graphql-js
a4a5247 Update dependencies
596184e Update dependencies
5025f9b Update dependencies
af2e837 Sync with upstream example
b21e481 Properly use IndexLink
281bdd9 Update dependencies
4976138 Clarify how to access local example
1170d76 Update copy a bit
ebd36b9 Need babel-runtime too
278cb42 Properly pin react-router dependency
b7fcac6 Update README.md
cf34189 Fix build script
b2d8970 Update README.md
49b9545 Add missing dependency
b65227b Update README.md
bdd98cb Implement TodoMVC
09d5ca3 Initial commit
REVERT: 437ff9c Squashed 'examples/todomvc-modern/' changes from aebfa93..76b9016
REVERT: 3386e8f Squashed 'examples/todomvc-modern/' changes from e5d1f40..aebfa93
REVERT: 78930fa Squashed 'examples/todomvc-modern/' changes from 80a966f..e5d1f40
REVERT: 953911e Squashed 'examples/todomvc-modern/' changes from 6a6abb9..80a966f
REVERT: d9083b4 Squashed 'examples/todomvc-modern/' changes from 668f02a..6a6abb9
REVERT: 24d38a4 Squashed 'examples/todomvc-modern/' changes from e6d4e86..668f02a
REVERT: bc74832 Squashed 'examples/todomvc-modern/' content from commit e6d4e86

git-subtree-dir: examples/todomvc
git-subtree-split: f5f341e34fc98380c6ea7c12be394ad813568164
taion added a commit that referenced this issue Mar 19, 2019
433892f Merge branch 'found-modern' into found-modern-universal
f5f341e docs: Fix docs
ad96285 fix: Fix tooling
22a3af9 fix: Fix network layer
6e057a1 Merge branch 'found-modern' into found-modern-universal
a6cab23 fix: Various bugfixes (#41)
51270b1 Merge branch 'found-modern' into found-modern-universal
5c7fb83 chore: Update dependencies (#30)
cc1085a more
5d616b2 chore: Update dependencies
1c103e3 Merge branch 'found-modern' into found-modern-universal
76b9016 Update dependencies
cd6b3f1 Merge branch 'found-modern' into found-modern-universal
aebfa93 Fix build
73c5c83 Update `found-modern-universal` example app with `relay-network-modern` (#28)
1260aab Merge branch 'found-modern' into found-modern-universal
e6564fe Update dependencies
e5d1f40 Update dependency
2bd7b54 Merge branch 'found-modern' into found-modern-universal
ba4651a Update dependencies
ae69ae5 Merge branch 'found-modern' into found-modern-universal
80a966f Fix pattern
59254ab Use hydrate instead of render
3b5fd9a Merge branch 'found-modern' into found-modern-universal
6a6abb9 Update dependencies
d6d2397 Merge branch 'master' into found-modern-universal
668f02a Downgrade graphql
57f77eb Merge branch 'found-modern'
4d2f7d8 Update dependencies
8efad95 Relay Modern with server-side rendering
e6d4e86 Use Found Relay Modern
8634bba Merge pull request #21 from taion/update-readme
597aeef Add found-modern-universal [ci skip]
6d89772 Use Found Relay Classic
2394893 Merge pull request #20 from taion/update-README
b265b6f Update project naming in README [ci skip]
671f3c2 Merge pull request #19 from taion/update-README
cc249f3 Update README [ci skip]
1a86b11 Merge branch 'master' into found-classic
a15f5a1 Merge pull request #18 from taion/fix-readme
8b1f8a1 Remove wrong note in README
87bb04b Update for Found v0.3.x
317f4c1 Use Found
38a8dcc Merge pull request #17 from taion/upgrade-relay
c7fa52b Upgrade to Relay v1.x (not Relay Modern)
6b062cd Merge pull request #15 from taion/fix-dev-source-map
c690479 Fix dev source map
34ecfea Merge pull request #14 from taion/fix-webpack
59e36ec Fix webpack config
efef591 Merge pull request #13 from taion/fix
1ca22f1 More fixes
a30143f Merge pull request #12 from taion/update
fe44bef Update dependencies
0e4a1fd Merge pull request #11 from alexmcmillan/master
078b6b9 Updating links to official Relay TodoMVC application and license
ddfe02d Merge pull request #9 from taion/passPerPreset
36cb4ac Drop passPerPreset
3ef9ccb Merge pull request #8 from taion/fix-mutations
a8a424e Fix mutations
af2b8bc Merge pull request #7 from taion/update
76c1194 Update everything to newest
76c527a Upgrade react-router-relay
73529e1 Move back to React Router
5a5dcbe Update checked-in schema
d4bba5d Update dependencies and move to rrtr (#6)
edb3dff Update for React Router v2.x
c7d70f6 Actually update the dumped schema
9174561 Fix limit to work with new graphql-js
a4a5247 Update dependencies
596184e Update dependencies
5025f9b Update dependencies
af2e837 Sync with upstream example
b21e481 Properly use IndexLink
281bdd9 Update dependencies
4976138 Clarify how to access local example
1170d76 Update copy a bit
ebd36b9 Need babel-runtime too
278cb42 Properly pin react-router dependency
b7fcac6 Update README.md
cf34189 Fix build script
b2d8970 Update README.md
49b9545 Add missing dependency
b65227b Update README.md
bdd98cb Implement TodoMVC
09d5ca3 Initial commit
REVERT: b76ab0f Squashed 'examples/todomvc-modern-universal/' changes from cd6b3f1..1c103e3
REVERT: d83d5db Squashed 'examples/todomvc-modern-universal/' changes from 2bd7b54..cd6b3f1
REVERT: 6ff12fe Squashed 'examples/todomvc-modern-universal/' changes from ae69ae5..2bd7b54
REVERT: 0da779c Squashed 'examples/todomvc-modern-universal/' changes from 59254ab..ae69ae5
REVERT: 9d6fdd1 Squashed 'examples/todomvc-modern-universal/' changes from d6d2397..59254ab
REVERT: c1b5604 Squashed 'examples/todomvc-modern-universal/' changes from 8efad95..d6d2397
REVERT: f57793f Squashed 'examples/todomvc-modern-universal/' content from commit 8efad95

git-subtree-dir: examples/todomvc-universal
git-subtree-split: 433892f4b2c9ef2fc251f2647d6c6db8e6df7304
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

No branches or pull requests

2 participants