Closed alariej closed 4 years ago
In your componentDidMount, do you call super.componentDidMount?
I think you have to use the UNSAFE_ versions of the functions now.
@berickson1 I wasn't calling super in componentDidMount. Now it works, thanks. I should have checked the ToDoList sample app: super.componentDidMount() is correctly called each time.
@deregtd I don't think there is an UNSAFE_ version for componentDidMount. At least not in React 16.12.
I just ported a small project to the latest versions of ReactXP and ReSub. The project dependencies are:
"@react-native-community/netinfo": "^3.2.1", "react": "16.12.0", "react-dom": "16.12.0", "react-native": "0.59.10", "react-native-windows": "0.59.0-rc.3", "reactxp": "2.0.0", "reactxp-netinfo": "^2.0.0", "reactxp-virtuallistview": "^2.1.0", "reactxp-webview": "^2.0.0", "resub": "^2.0.0-rc.2", "simplerestclients": "^0.2.12", "synctasks": "^0.3.3"
There seems to be some sort of problem when using
_buildState
and the React lifecycle functioncomponentDidMount
in the same component.When
componentDidMount
is not present,_buildState
runs right afterconstructor
with theinitialBuild
parameter being true. Then comes arender
, and a second_buildState
(withinitialBuild
being false) triggered by a@autoSubscribeWithKey
decorator in a data store.When I add
componentDidMount
in the component, the second_buildState
never gets triggered by the subscription key from the data store.When I add
componentDidMount
with asetState
call inside it, the_buildState
gets called a second time (probably because of thesetState
call, not because of the subscription key), but itsinitialBuild
parameter remains set to true.There was no such problem using older versions of ReactXP and ReSub.
Is it not allowed anymore to use
_buildState
together withcomponentDidMount
in the latest version of ReSub?