Skip to content

Resolvables override new InputSignals with raw value  #998

@Lubjan

Description

@Lubjan

The Angular team introduced signals but more importantly, signal inputs with Version 18.
The problem with the new signals is that they act as functions, which UI-Router doesn't seem to handle.

Example

@Component({
  selector: 'app-some',
  standalone: true,
  imports: [CommonModule],
  template: `{{ someInput() }}`,
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class SomeComponent {
  readonly someInput = input<string>(null);
}
const states: Ng2StateDeclaration[] = [
  {
    name: 'some-state',
    url: '/some',
    component: SomeComponent,
    resolve: {
      someInput: [async () => await of('Resolved value').toPromise()],
    },
  },
];

Expected behavior

  • UI-Router should resolve the someInput resolvable
  • The resolved value should be set for the signal input using someInput.set(value)
  • The input in the component should still be a usable signal input (access to someInput(), someInput.set(...), someInput.update(...), etc...)

Actual behavior

  • UI-Router resolves the value correctly
  • The resolved value is then set as a raw value, overriding the signal input (and making it a plain string in this example)
  • The signal input can no longer be used as intended (using someInput() in the component would throw [...] is not a function when navigated to)

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

    Issue actions