gothinkster / react-mobx-realworld-example-app

Exemplary real world application built with React + MobX
https://react-mobx.realworld.io/
MIT License
1.25k stars 266 forks source link

Fix loading of article and clearing of state in editor page #16

Closed cfilby closed 7 years ago

cfilby commented 7 years ago

References #15

This change updates to the router to use a single Editor route entry with an optional parameter (/editor/:slug?). It also corrects a typo in the nextProps.match.params access. These two changes restored the 'article editing' functionality for my locally running instance.

Please let me know if there's anything that needs changing.

cfilby commented 7 years ago

Should now also address #16.

I updated editorStore.setArticleSlug to reset the form state if a new article slug is set (this could also be moved to loadInitialData as well or just be a direct call in Editor), and changed componentWillReceiveProps to componentDidUpdate since the React Docs indicate that this is a good place to kick off the network requests. I can also revise this if we want the synchronous portion of setting the article slug in componentWillReceiveProps.

andykog commented 7 years ago

Thanks @cfilby!