Workiva / Workiva/over_react

UIP-3014 Warn when key uses default toString impl

Open
#135 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Dart
Stars
432
Forks
57
PR merge metrics
No merged PRs in 30d

Description

With key being dynamic and toString-ing values, it's easy to pass in any object.

It's also easy to pass in objects with non-unique toString implementations, such as the default Object.toString, and not notice that the value won't help when keying.

class Foo {
  final bar;
  Foo(this.bar);
}
..key = new Foo(1) // Uses "Instance of 'Foo'" as key
..key = new Foo(2) // Uses "Instance of 'Foo'" as key

We should check whether values like this are specified (perhaps via a regex, like ^Instance of '[_\$a-zA-Z0-9]+'$) and warn in the console.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the key-handling entry point and the existing console-warning path, then reproduce the two Foo examples from the issue. The work is done when values using Dart's default object toString form trigger a console warning while other key values continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.