Skip to content

Conversation

@sapphi-red
Copy link
Member

@sapphi-red sapphi-red commented Nov 25, 2024

Description

Alternative to #18750.

Instead of making import.meta.hot.send async, this PR makes ModuleRunnerTransport to disallow send to be async. This way we can avoid the breaking change.

@sapphi-red sapphi-red added the p3-minor-bug An edge case that only affects very specific usage (priority) label Nov 25, 2024
Comment on lines +234 to +236
connectingPromise.then(() => {
invokeableTransport.send!(data)
})
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For sends that were called while connecting the error would be voided and won't be able to catch by the user. In Vite 5, the error happened for the send call later that was called (which is confusing I guess).

public send(message: string): void {
this.queue.push(message)
this.flush()
}
public flush(): void {
if (this.connection.isReady()) {
this.queue.forEach((msg) => this.connection.send(msg))
this.queue = []
}
}

@sapphi-red
Copy link
Member Author

closing as #18753 was merged

@sapphi-red sapphi-red closed this Nov 26, 2024
@sapphi-red sapphi-red deleted the feat/disallow-async-send-transport branch November 26, 2024 01:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat: environment API Vite Environment API p3-minor-bug An edge case that only affects very specific usage (priority)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant