-
Notifications
You must be signed in to change notification settings - Fork 561
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
Refactor CommandEngine
to JSON-RPC
#11
Conversation
037434a
to
94e90fa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! If I didn't know about the ID rabbit hole I'd say this looked like it was easy 😅
packages/workers/src/PluginWorker.ts
Outdated
|
||
if (!id || typeof id !== 'string') { | ||
if (!id && typeof id !== 'string' && typeof id !== 'number') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have complete control over the IDs that come in over this stream, so I think we can mostly keep the original implementation, and just expect either a number
or string
.
If we're expecting a number
, I think we can just do the following, unless we want to e.g. enforce that the numbers are integers.
if (!id && typeof id !== 'string' && typeof id !== 'number') { | |
if (typeof id !== 'number') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check will permit the empty string as an id
. Since we're using nanoid
now, I think we can revert this and go with the original condition.
CommandEngine
to JSON-RPC
CommandEngine
to JSON-RPC
Co-authored-by: Erik Marks <[email protected]>
Co-authored-by: Erik Marks <[email protected]>
Co-authored-by: Erik Marks <[email protected]>
57174dc
to
0d356c9
Compare
packages/workers/src/PluginWorker.ts
Outdated
|
||
if (!id || typeof id !== 'string') { | ||
if (!id && typeof id !== 'string' && typeof id !== 'number') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check will permit the empty string as an id
. Since we're using nanoid
now, I think we can revert this and go with the original condition.
6e165c3
to
3d554c7
Compare
3d554c7
to
3e08fc1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's gooo!
fixes #10