Skip to content

Conversation

RishhiB
Copy link
Contributor

@RishhiB RishhiB commented Jun 12, 2025

This PR adds a changeset to document an upcoming breaking change to the disconnect event in the driver layer. The reason parameter will become optional to enable better handling of clean, intentional disconnections.

Breaking Changes

disconnect event reason parameter will become optional

To enable better handling of clean, intentional disconnects (e.g. Container.dispose()), the reason parameter of the disconnect event on IDocumentDeltaConnectionEvents is being deprecated as a required parameter.

Current signature:

listener: (reason: IAnyDriverError) => void

Future signature (v2.60):

listener: (reason?: IAnyDriverError) => void

Impact: 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.

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

@RishhiB RishhiB requested a review from jason-ha June 12, 2025 16:46
@RishhiB RishhiB self-assigned this Jun 12, 2025
@Copilot Copilot AI review requested due to automatic review settings June 12, 2025 16:46
@RishhiB RishhiB requested a review from a team as a code owner June 12, 2025 16:46
Copy link
Contributor

@Copilot Copilot AI left a 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.

@github-actions github-actions bot added changeset-present base: main PRs targeted against main branch labels Jun 12, 2025
@RishhiB RishhiB requested a review from a team as a code owner June 12, 2025 17:05
@github-actions github-actions bot added the public api change Changes to a public API label Jun 12, 2025
Co-authored-by: Joshua Smithrud <54606601+Josmithr@users.noreply.github.com>
RishhiB and others added 5 commits June 12, 2025 10:16
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>
Copy link
Contributor

🔗 No broken links found! ✅

Your attention to detail is admirable.

linkcheck output


> fluid-framework-docs-site@0.0.0 ci:check-links /home/runner/work/FluidFramework/FluidFramework/docs
> start-server-and-test "npm run serve -- --no-open" 3000 check-links

1: starting server using command "npm run serve -- --no-open"
and when url "[ 'http://127.0.0.1:3000' ]" is responding with HTTP status code 200
running tests using command "npm run check-links"


> fluid-framework-docs-site@0.0.0 serve
> docusaurus serve --no-open

[SUCCESS] Serving "build" directory at: http://localhost:3000/

> fluid-framework-docs-site@0.0.0 check-links
> linkcheck http://localhost:3000 --skip-file skipped-urls.txt

Crawling...

Stats:
  225443 links
    1710 destination URLs
    1941 URLs ignored
       0 warnings
       0 errors


@github-actions github-actions bot removed the public api change Changes to a public API label Jun 12, 2025
Copy link
Contributor

@Josmithr Josmithr left a 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!

RishhiB and others added 2 commits June 12, 2025 13:28
Co-authored-by: Joshua Smithrud <54606601+Josmithr@users.noreply.github.com>
@RishhiB RishhiB requested a review from Josmithr June 12, 2025 20:28
@RishhiB RishhiB enabled auto-merge (squash) June 12, 2025 20:30
@RishhiB RishhiB merged commit 82a1c5a into microsoft:main Jun 12, 2025
34 checks passed
Copy link
Contributor

@jason-ha jason-ha left a 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.

Comment on lines +2 to +4
"@fluidframework/container-loader": minor
"@fluidframework/driver-base": minor
"@fluidframework/driver-definitions": minor
Copy link
Contributor

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.
Copy link
Contributor

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.

Copy link
Contributor Author

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

Comment on lines +241 to +246
/**
* @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.
*/
Copy link
Contributor

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**.
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
base: main PRs targeted against main branch changeset-present
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants