I'd like to know if there's a way to update a part of the URL reactively without using FlowRouter.go() while using React and react-layout:
I want to change the value in the document that is used to get the document from the DB. For example, if I have a route like ~/users/:username and update the username field in the document, I then have to user FlowRouter.go('profile', {data}) to direct the user to that new URL. The "old" route is gone.
Below is the working version I have, but there are two issues:
I have to use FlowRouter.go(), which is actually a full page refresh (and going back would be a 404).
I still get errors in the console because for a brief moment the reactive data for the component is actually wrong.
Relevant parts of the component like this:
...
mixins: [ReactMeteorData],
getMeteorData() {
let data = {};
let users = Meteor.subscribe('user', {this.props.username});
if (user.ready())
data.user = user;
return data;
}
...
updateName(username) {
Users.update({_id:this.data.user._id}, {$set:{username}}, null, (e,r) => {
if (!e)
FlowRouter.go('profile', {username});
});
},
...
I'd like to know if there's a way to update a part of the URL reactively without using
FlowRouter.go()
while using React andreact-layout
:I want to change the value in the document that is used to get the document from the DB. For example, if I have a route like
~/users/:username
and update theusername
field in the document, I then have to userFlowRouter.go('profile', {data})
to direct the user to that new URL. The "old" route is gone.Below is the working version I have, but there are two issues:
FlowRouter.go()
, which is actually a full page refresh (and going back would be a 404).Relevant parts of the component like this:
The route is like this:
The errors I get are:
and
Thanks in advance!