-
Notifications
You must be signed in to change notification settings - Fork 556
docs(driver): Add deprecation comment and changeset for disconnect event #24840
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
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.
Pull Request Overview
This PR updates documentation to deprecate the required reason
parameter for the disconnect
event, indicating that it will become optional in the upcoming v2.60 release.
- Adds a deprecation comment to the
disconnect
event in the driver definitions. - Updates the changeset to document the breaking change for affected packages.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
File | Description |
---|---|
packages/common/driver-definitions/src/storage.ts | Adds a deprecation comment to the disconnect event listener signature. |
.changeset/fuzzy-turkeys-help.md | Provides a changeset detailing the breaking change with the updated event signature. |
Co-authored-by: Joshua Smithrud <54606601+Josmithr@users.noreply.github.com>
Co-authored-by: Joshua Smithrud <54606601+Josmithr@users.noreply.github.com>
Co-authored-by: Joshua Smithrud <54606601+Josmithr@users.noreply.github.com>
Co-authored-by: Joshua Smithrud <54606601+Josmithr@users.noreply.github.com>
🔗 No broken links found! ✅ Your attention to detail is admirable. linkcheck output
|
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.
Left one more small suggestion. Otherwise, looks good to me!
Co-authored-by: Joshua Smithrud <54606601+Josmithr@users.noreply.github.com>
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.
I think some revisions are needed.
"@fluidframework/container-loader": minor | ||
"@fluidframework/driver-base": minor | ||
"@fluidframework/driver-definitions": minor |
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.
How did you pick this set? To me it feels either too short or too long. Why container-loader but not others?
--- | ||
The reason parameter on the disconnect event is now optional to allow for clean, non-error disconnections. | ||
|
||
To enable better handling of intentional disconnects (for example [`Container.dispose()`](https://fluidframework.com/docs/api/container-loader/container/dispose)), the `reason` parameter of the `disconnect` event on [`IDocumentDeltaConnectionEvents`](https://fluidframework.com/docs/api/driver-definitions/idocumentdeltaconnectionevents) is being deprecated as a required parameter. |
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.
"deprecated as a required parameter" seems odd for an event. In practice we'll probably always send an argument. It is just that undefined
might be the value we send.
Think about it this way. What if there was other information that we wanted to send with this event? What if we always wanted to send some other argument that follows reason
? What would the signature look like? Internally how would we pass the second parameter without the first? (Hint: it can't be done in current versions of TypeScript.)
So optional is not the right signature for an event.
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.
changing this to required but allowed to be undefined
/** | ||
* @param reason - The reason for the disconnection. | ||
* Note: this parameter will become optional in a future release to support clean disconnections. | ||
* Signature will change from `(reason: IAnyDriverError) => void` to `(reason?: IAnyDriverError) => void`. | ||
* Update your listener implementations to handle cases where `reason` is undefined. | ||
*/ |
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.
How does this doc work? reason
is not a parameter of (event: "disconnect", listener: ...)
?
Developers with listeners for the `disconnect` event should update their implementations to handle cases where the `reason` parameter is `undefined`. | ||
This indicates a clean disconnect, which should not be treated as an error. | ||
|
||
The breaking change is scheduled to be released in version **2.60**. |
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.
text files should always have an empty blank line at the end
This PR adds a changeset to document an upcoming breaking change to the
disconnect
event in the driver layer. Thereason
parameter will become optional to enable better handling of clean, intentional disconnections.Breaking Changes
disconnect
eventreason
parameter will become optionalTo enable better handling of clean, intentional disconnects (e.g.
Container.dispose()
), thereason
parameter of thedisconnect
event onIDocumentDeltaConnectionEvents
is being deprecated as a required parameter.Current signature:
Future signature (v2.60):
Impact: Developers with listeners for the
disconnect
event should update their implementations to handle cases where thereason
parameter isundefined
. This indicates a clean disconnect, which should not be treated as an error.Timeline: The breaking change is scheduled to be released in version 2.60.
Reviewer Guidance
This is a documentation-only change that adds a changeset to inform users of an upcoming breaking change. The changeset will be processed during the next release to generate appropriate release notes and version bumps for the affected packages:
@fluidframework/container-loader
@fluidframework/driver-base
@fluidframework/driver-definitions