infinitered / infinitered/reactotron

"command" in onCustomCommand

Open
#1,043 1 comment 0 reactions 1 assignee View on GitHub

@rmevans9 is already working on this.

Since May 17, 2019.

discussion :speech_balloon:
Dominant language
TypeScript
Stars
15.6k
Forks
972
PR merge metrics
No merged PRs in 30d

Description

Right now when you set up a custom command, you need to supply it with a mandatory handler and a "command" property; eg.:

```
Reactotron.onCustomCommand({
command: 'command 1',
handler: () => console.tron.log('hi')
});
```

Unfortunately, this property, while mandatory, seems to be totally useless. The optional "title" property actually seems to serve whatever functionality this "command" property should have served:

```
Reactotron.onCustomCommand({
command: 'command 1', // Do nothing but is mandatory
title: 'command 1', // Actually sets the command's name in the Reactotron UI
handler: () => console.tron.log('hi')
});
```

I looked into the codebase and it's only being used to ensure uniqueness (https://github.com/infinitered/reactotron-core-client/blob/06648fb8b7fb4cfe5eec37f81ba3e974b8a44318/src/reactotron-core-client.ts#L441) but I don't really see the point of guarding against that; even if we do want to do that, that can also be easily achieved using either the ID or the "title" property.

I suggest we merge these two properties into one, potentially still calling it "command" to avoid a breaking change.

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.