Skip to content

null parameter value does not work when inherit is true #53

@christopherthielen

Description

@christopherthielen

In some cases, a null query parameter value does not take effect. When a query parameter has a value, and is updated to be 'null', it may not take effect.

Here is a failing unit test:

    it('should not inherit previous params when new params are passed', async(done) => {
      router.stateRegistry.register({
        name: 'foo',
        url: '?fooParam',
      });

      await $state.go('foo', { fooParam: 'abc' });
      expect(router.globals.params).toEqualValues({ fooParam: 'abc' });

      await $state.go('foo', { fooParam: undefined });
      expect(router.globals.params).toEqualValues({ fooParam: null });

      done();
    });
FAILED transition inherited params should not inherit previous params when new params are passed
debug.js:21 Uncaught Expected StateParams({ #: null, fooParam: 'abc' }) to equal values Object({ fooParam: null }).
    at Suite.<anonymous> (http://localhost:8080/base/test/index.js:20452:56)
    at step (http://localhost:8080/base/test/index.js:19674:24)
    at Object.next (http://localhost:8080/base/test/index.js:19655:54)
    at fulfilled (http://localhost:8080/base/test/index.js:19646:59)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions