Skip to content

[Bug] Component key is sometimes a string and sometimes an int #727

@gsxdsm

Description

@gsxdsm

Bug Description

The "key" for a component when passed in through a template is usually passed in as a number, however when a component gets deserialized from a server call it is parsed as a string. This causes sporadic bugs with method calls when you pass in a component key as the target.

Expected behaviour

Component keys should always be a string or a number - or the comparison for key lookup in unicorn.js could use type coercion -

  if (_component.key === componentNameOrKey) {
    component = _component;
  }

  if (_component.key == componentNameOrKey) {
    component = _component;
  }

But that seems a bit hacky.

Screenshots / Screenrecords

N/A

Steps to reproduce

No response

What browsers are you seeing the problem on?

Chrome

👀 Have you checked for similar open issues?

  • I checked and didn't find similar issue

Code of Conduct

  • I agree to follow this project's Code of Conduct

Are you willing to work on this issue ?

No, someone else can work on it

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions