Skip to content

Object in query string parameters does not trigger "route change" if its properties changes #1509

@ppdeassis

Description

@ppdeassis

Version

2.5.3

Reproduction link

http://jsfiddle.net/6znsr5wd/3/

Steps to reproduce

  1. Access fiddle and click on Access Home
  2. Enter any value on the input
  • it will be the object property used on query string
  1. Click on Update route button
  • it will replace the route, using the object on query string
  • the query string will be rendered in the <code> tag
  1. Change the value on the input and click on Update route again

What is expected?

The query string is updated with the new value on the object property.

What is actually happening?

The query string remains the same, ignoring the change on object's property.


After some digging in the code, I think I found the object comparison method used in confirmTransition method (which uses isSameRoute), and it does a simple "non-deep" comparison of properties on query string. Since it's using an Object on the query string, it should do a deep (recursive) comparison of Object properties.

Activity

posva

posva commented on Jun 15, 2017

@posva
Member

dup of #1421
FYI, vue-router does not support nested queries by default, but you can use a lib like qs: http://jsfiddle.net/posva/y5boz2jf/1/
There's already a PR for this at #1425

changed the title [-]Object in query string parameters do not trigger "route change" if its properties changes[/-] [+]Object in query string parameters does not trigger "route change" if its properties changes[/+] on Jun 15, 2017
ppdeassis

ppdeassis commented on Jun 15, 2017

@ppdeassis
Author

Thanks, @posva.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @posva@ppdeassis

        Issue actions

          Object in query string parameters does not trigger "route change" if its properties changes · Issue #1509 · vuejs/vue-router