File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed
Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -263,7 +263,7 @@ export default class Router extends String {
263263 ) ;
264264 } else if (
265265 segments . length === 1 &&
266- ! params [ segments [ 0 ] . name ] &&
266+ ! params . hasOwnProperty ( segments [ 0 ] . name ) &&
267267 ( params . hasOwnProperty ( Object . values ( route . bindings ) [ 0 ] ) || params . hasOwnProperty ( 'id' ) )
268268 ) {
269269 // If there is only one template segment and `params` is an object, that object is
Original file line number Diff line number Diff line change @@ -603,6 +603,10 @@ describe('route()', () => {
603603 expect ( route ( 'posts.update' , 0 ) ) . toBe ( 'https://ziggy.dev/posts/0' ) ;
604604 } ) ;
605605
606+ test ( 'can handle an object parameter with a falsy value for the segment name' , ( ) => {
607+ expect ( route ( 'posts.show' , { post : 0 } ) ) . toBe ( 'https://ziggy.dev/posts/0' ) ;
608+ } ) ;
609+
606610 test ( 'can accept a custom Ziggy configuration object' , ( ) => {
607611 const config = {
608612 url : 'http://notYourAverage.dev' ,
You can’t perform that action at this time.
0 commit comments