Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
CreateRoomDialog is rendered before get the config default_federate v…
Browse files Browse the repository at this point in the history
…alue

In React the order of the execution of mount and render functions
is: `componentWillMount --> render --> componentDidMount`

The `CreateRoomDialog` `render()` function is executed before than
the `componentDidMount()` function so the

  `this.defaultNoFederate = config.default_federate === false;`

; instruction which is executed in the `componentDidMount` function
(in `CreateRoomDialog`) is evaluated always after than the rendering
of the page.

Therefore, the obvious issue is that the values obtained from the
`SdkConfig.get()` function (`config.default_federate`) are obtained
later than their usage on `render()`.

This patch makes this change to fix the described issue:

* componentWillMount instead of componentDidMount

Signed-off-by: Pablo Saavedra <[email protected]>
  • Loading branch information
psaavedra committed Jul 23, 2018
1 parent fc29e89 commit 8f68cdd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/views/dialogs/CreateRoomDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default React.createClass({
onFinished: PropTypes.func.isRequired,
},

componentDidMount: function() {
componentWillMount: function() {
const config = SdkConfig.get();
// Dialog shows inverse of m.federate (noFederate) strict false check to skip undefined check (default = true)
this.defaultNoFederate = config.default_federate === false;
Expand Down

0 comments on commit 8f68cdd

Please sign in to comment.