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

[feat] allow same cbs on different routes #68

Closed
wants to merge 1 commit into from

Conversation

rook2pawn
Copy link

There is an issue where

app.route('/', view)
app.route('/b', view) 
app.route('/c', view)

all end up returning the route as c because wayfarer sticks the route on the reference. which in turn puts the wrong data in state.route as they all resolve to the last known route appended to the callback.

The solution proposed herein simply clones the callback cleanly and thus the trie code doesn't need to be modified. The alternative is to modify trie which is a bit more complex. This is the simplest solution i can think of. Related to #67

@yoshuawuyts @tornqvist

@tornqvist
Copy link
Member

tornqvist commented Apr 23, 2018

This was actually resolved in #66 but never made it to a new release. My later PR (#67) went further and simply removed the route property from the callback, which I think is more robust since a wrapper function can sometimes get in the way if the callback is anything but a function.

@rook2pawn
Copy link
Author

Ah, very good! Thanks for the explanation of both.

@rook2pawn rook2pawn closed this Apr 23, 2018
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.

None yet

2 participants