michelmansour / virgil

A delightful way to share, discuss, and annotate poetry
MIT License
2 stars 2 forks source link

Fix login when hitting `/login` directly 🐞 #16

Open michelmansour opened 7 years ago

michelmansour commented 7 years ago

The next pathname of the location object is only set by the auth redirect flow, which is not executed when the user navigates directly to /login. Setting Login.defaultProps was an attempt to address this edge-case, but it seems that React only performs a shallow merge of defaultProps with the incoming props. Instead, we explicitly set the pathname to / if location.state.nextPathname is unset.