kitze/mobx-router

Adding 0 as a parameter doesn't show up in <Link>

TimDaub opened this issue · 2 comments

Sorry for this slightly confusing headline.

I have:

                       <Link
                            view={views.pay}
                            params={{
                                id: vuln.id
                            }}
                            store={this.props.store}>
                            Pay
                        </Link>

Where vuln.id is 0 of type integer. However when it's 0, mobx-router's Link is not including it into the URL "http://localhost:3000/pay/", while when I call vuln.id.toString() it does.

thdk commented

Likely to be related to #46

thdk commented

I've tested this locally and found out that when you pass a zero to any property of the params object, it won't be displayed in the url but it will be available in the params object in 'onbeforeenter' and its also available as store.router.params.id.

However, it does make sense to display '0' in the url so I've made the changes suggested in #46 and created a PR for this.