-
Notifications
You must be signed in to change notification settings - Fork 14
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
Fix Port
message loss before attachFS
is called
#93
Conversation
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.
Looks good. I made some comments about minor things, but overall I think this PR is solid. Sorry for taking so long to get back to you.
For the test names, I would prefer if it didn't include browser in the name. After all, the tests are actually run in Node. Perhaps naming it config.test.ts
/config.worker.js
would be more clear as to what the test is for?
@@ -308,3 +309,11 @@ export const Port = { | |||
return new PortFS(options); | |||
}, | |||
} satisfies Backend<PortFS, RPC.Options>; | |||
|
|||
export async function resolveRemoteMount<T extends Backend>(port: RPC.Port, config: MountConfiguration<T>, _depth = 0): Promise<FilesystemOf<T>> { |
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.
_depth
is an argument used internally by resolveMountConfig
to track recursive calls and avoid infinite loops. I don't think it should be used here, though it could be helpful for debugging.
I hope you don't mind, I made some of the minor changes I mentioned. If you don't mind answering, is there a reason you opened a new PR vs opening the old one? Anyway, thanks again for helping out with this.
This is a much better solution than what I did in my suggestion, just thought I'd point that out =) |
Port
message loss before attachFS
is called
There wasn't a specific reason just wanted to do so :D
Yeah you did point it out really
Just changed them I think this pr is done now
No worries.... |
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.
Everything looks good, I'll merge it. Thanks again, I really appreciate contributions!
Thank you for your response, here is what i came up with
instead of implementing
port.emit('message', data)
calledhandleRequest
directly as it's whatattachFS
would doreturned the fs that's resolved from awaiting resolveMountConfig and added proper types
finally the tests look like this, i named the files with
.browser
extension lmk if you'd like me to changeworker.browser.js
remote.browser.test.ts