You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The idea here is to load localization values a component needs in addition to any promises that need to be resolved prior to rendering.... I noticed a problem with this approach - I would sometimes get ready set to true without firing done, and no locale key found would show up.
(Initially, I tried to fix this by adding some kind of uniqueness to the component, so instead of a generic ready I actually used the name of the component as the key for done and for checking. This seemed to work initially, but has a flaw if multiples of the same component are in use - only the first is rendered.... (see this revision))
Anyway, inspecting the props of the component at the time of componentWillMount I found that I was getting the wrong data context the done was fired with. I tested this by including the name of the component with the ready boolean - and in some cases, the name as completely different than what should have been loading. This results in the component thinking it's already loaded and not going further.
I had a line to test this inside the componentWillMount
Here's the thing, this.idx is undefined always here. There is a this.index property. I tried toggling it to test it out and... everything works properly.
Is this a typo?
The text was updated successfully, but these errors were encountered:
I'm working on a higher order component that wraps
fetchState
. You can see it here:https://github.com/tswaters/react-todo/blob/e0e539ae21528dfac07d1fdf24458012f0861a83/src/common/initial-data.jsx
The idea here is to load localization values a component needs in addition to any promises that need to be resolved prior to rendering.... I noticed a problem with this approach - I would sometimes get
ready
set to true without firing done, andno locale key found
would show up.(Initially, I tried to fix this by adding some kind of uniqueness to the component, so instead of a generic
ready
I actually used thename
of the component as the key for done and for checking. This seemed to work initially, but has a flaw if multiples of the same component are in use - only the first is rendered.... (see this revision))Anyway, inspecting the
props
of the component at the time of componentWillMount I found that I was getting the wrong data context thedone
was fired with. I tested this by including thename
of the component with theready
boolean - and in some cases, the name as completely different than what should have been loading. This results in the component thinking it's already loaded and not going further.I had a line to test this inside the
componentWillMount
So, I went to randomly digging around the
react-router-server
code and I came across this line:react-router-server/src/components/fetchState.jsx
Line 18 in 8472080
Here's the thing,
this.idx
is undefined always here. There is athis.index
property. I tried toggling it to test it out and... everything works properly.Is this a typo?
The text was updated successfully, but these errors were encountered: