-
-
Notifications
You must be signed in to change notification settings - Fork 187
Description
I have an interesting problem and I would love some thoughts on the best solution.
I have a map instance which has a moveend listener. After the user moves the map I trigger an action called mapMoved which stores the center and zoom etc.
To prevent the map from trying to move again on componentWillReceiveProps (because I've just moved it manually) I look for the original mouseevent to know it's human interaction and add the property human:true.
Now, when I try to undo the action it works as expected except the human flag is still present.
Is it an anti-pattern to suggests an optional property which flags the fact it's an undo action... e.g
{
present:{},
past:[],
future:[],
undid: true
}
Alternatively I could add some logic to stop the map moving if mapOptions.future.length === 0 (this is the simplest solution), or add logic to mapStateToProps to check the map isn't in the final position already (least ideal).
Thanks!