Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command priorities as constants #1775

Merged
merged 2 commits into from
Apr 16, 2022
Merged

Command priorities as constants #1775

merged 2 commits into from
Apr 16, 2022

Conversation

zurfyx
Copy link
Member

@zurfyx zurfyx commented Apr 15, 2022

Unlikely HTML conversion we have always labeled priorities in code: CRITICAL, HIGH etc.

Priorities are traditionally numbers and to do so requires to have a cast around listener like (0: EditorPriority) or similar. This is not quite ergonomic and tends to lead to either:

  1. No type cast at all - just a number on the listener
  2. In some places we have abstracted this number into the same constant I'm proposing in this PR

For this reason, I'm proposing to standarize this into the core.

A very similar strategy would be to ship an object with these values but 5 constants will be way lighter than shipping an object with values, which will pay off in larger apps.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 15, 2022
@vercel
Copy link

vercel bot commented Apr 15, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
lexical ✅ Ready (Inspect) Visit Preview Apr 15, 2022 at 11:39PM (UTC)
lexical-playground ✅ Ready (Inspect) Visit Preview Apr 15, 2022 at 11:39PM (UTC)

@zurfyx zurfyx merged commit 682fbfb into main Apr 16, 2022
@trueadm trueadm deleted the command-pri branch November 21, 2022 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants