diff --git a/public/js/classes/NetworkingManager.js b/public/js/classes/NetworkingManager.js index 099ff70..c95d9dd 100644 --- a/public/js/classes/NetworkingManager.js +++ b/public/js/classes/NetworkingManager.js @@ -36,7 +36,6 @@ export class NetworkManager { for (let i=this.app.global.world; i>this.app.worlds.length-1; i--) { this.app.worlds.unshift(new GameWorld(this.app)) - this.app.call('world update') } this.app.local.world.save = parsed.data.save // Overwrite the local save with the parsed save. diff --git a/public/js/components/Sidebar/Sidebar.jsx b/public/js/components/Sidebar/Sidebar.jsx index e1cc9e3..806af2b 100644 --- a/public/js/components/Sidebar/Sidebar.jsx +++ b/public/js/components/Sidebar/Sidebar.jsx @@ -23,12 +23,7 @@ export default class Sidebar extends React.Component { super(props) this.state = { page: 0, connected: false } this.handleChange = this.handleChange.bind(this) - this.pages = [this.homePage()]; - - app.subscribeToClientConnection(() => { - console.log(app.global.connected) - this.setState({ connected: app.global.connected }) - }) + this.pages = [this.homePage]; } shouldComponentUpdate (_, nextState) { @@ -40,12 +35,19 @@ export default class Sidebar extends React.Component { componentDidMount () { app.subscribeToClientConnection((connected) => { this.setState({ connected }) + this.forceUpdate(); }); - this.pages = [this.homePage(), this.savePage(), null, this.itemPage(), this.settingsPage(), this.accountPage()] + this.pages = [this.homePage, this.savePage, null, this.itemPage, this.settingsPage, this.accountPage] + app.local.world.subscribeSync(() => { + this.forceUpdate(); + }) + app.local.world.subscribeChangeScene(() => { + this.forceUpdate(); + }) } renderPage () { - return this.pages[parseInt(this.state.page)] + return this.pages[parseInt(this.state.page)](); } handleChange (e) { @@ -53,7 +55,6 @@ export default class Sidebar extends React.Component { } homePage () { - console.log(app.global.connected) return ( <> {app.global.connected ? :

Connect to a tracker to see the player list.

}