Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add routing #60

Merged
merged 17 commits into from
Apr 6, 2015
Merged

Add routing #60

merged 17 commits into from
Apr 6, 2015

Conversation

satishkunisi
Copy link
Collaborator

  • Includes react-router
  • Moves the logic in Quack component into a new Chat component so the router can transition to and from the main chat window
  • Adds an About component to demonstrate how the router works (it also forced me to fix the CSS). If it's superfluous I can remove it.

@@ -36,6 +36,7 @@ var ChannelMessages = React.createClass({
},

componentWillUnmount: function() {
MessageStore.removeListener('change', this._messageStoreChange);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to remove these listeners to prevent a React error when trying to unmount the component (while changing routes / switching component views). We do need to do some work to fix the 'two children with the same key warnings' (related to: #53)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, thats cool that React throws an error when that happens. Should be done anyway. Do you know why there is a 'two children with the same key warning'? Also, should we remove all the other listeners this way?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Browse to About then back to Chat and check out the console. If you log
MessageStore.all() you'll see dups.

On Fri, Apr 3, 2015 at 6:33 PM, Jack Noble notifications@github.com wrote:

In js/components/channel_messages.jsx
#60 (comment):

@@ -36,6 +36,7 @@ var ChannelMessages = React.createClass({
},

componentWillUnmount: function() {

  • MessageStore.removeListener('change', this._messageStoreChange);

Ah, thats cool that React throws an error when that happens. Should be
done anyway. Do you know why there is a 'two children with the same key
warning'?


Reply to this email directly or view it on GitHub
https://github.com/rorysaur/quack/pull/60/files#r27765333.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I misread your comment. I'm a little hazy on Flux still, so I don't exactly why it's happening. I know it has something to do with the way we're loading messages into the store. My initial assumption is that when the component was unmounted then mounted again the store would just reinitialize and fetch all the messages from Firebase but that wasn't happening...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More here: #21

@rorysaur
Copy link
Owner

rorysaur commented Apr 4, 2015

looks good to me 👍 and +1 for semantic HTML 😹 😹 i think @jacknoble should take a look tooo ⛽

@rorysaur
Copy link
Owner

rorysaur commented Apr 4, 2015

oh and can you add a little note in the readme ("Dependencies") whenever you add a dependency?

@jacknoble
Copy link
Collaborator

🍊 🎤 🎡 Looks good!

@jacknoble
Copy link
Collaborator

@satishkunisi What do you think about the router? Is it something we should use heavily or just occasionally?

@satishkunisi
Copy link
Collaborator Author

Well not for channels, but we'll need routes for login and I remember Rory mentioning another component that might need a separate route.

@rorysaur
Copy link
Owner

rorysaur commented Apr 4, 2015

i said router for channels just for practice, but if there are other things we could do with the router then it doesn't matter.

@rorysaur
Copy link
Owner

rorysaur commented Apr 4, 2015

settings menu, things like that.

@jacknoble
Copy link
Collaborator

Right, so it makes sense to practice/ becoming familiar with it. I'm personally sort of suspicious of the javascript router thing in general, it seems like it adds a layer of complexity to things without bringing much benefit. I'm trying to get a sense of whether react makes it simpler/safer such that it would be good to use on other projects.

@rorysaur
Copy link
Owner

rorysaur commented Apr 4, 2015

i get the impression that routes in react aren't as dominant of a class as they are in the big frameworks..

rorysaur added a commit that referenced this pull request Apr 6, 2015
@rorysaur rorysaur merged commit e893557 into master Apr 6, 2015
@rorysaur rorysaur deleted the add-routing branch April 6, 2015 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants