Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .changeset/wacky-results-prove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
"fluid-framework": minor
"@fluidframework/map": minor
"__section": breaking
---

## directory: Path parameter added to clear event

Check warning on line 7 in .changeset/wacky-results-prove.md

View workflow job for this annotation

GitHub Actions / vale

[vale] reported by reviewdog 🐶 [Microsoft.Headings] 'directory: Path parameter added to clear event' should use sentence-style capitalization. Raw Output: {"message": "[Microsoft.Headings] 'directory: Path parameter added to clear event' should use sentence-style capitalization.", "location": {"path": ".changeset/wacky-results-prove.md", "range": {"start": {"line": 7, "column": 4}}}, "severity": "INFO"}

The `clear` event for SharedDirectory now includes a `path` parameter indicating which directory was cleared.

**Before:**
```typescript
sharedDirectory.on("clear", (local, target) => {
// No way to know which subdirectory was cleared
});
```

**After:**
```typescript
sharedDirectory.on("clear", (path, local, target) => {
// path tells you which directory was cleared (e.g., "/", "/subdir1", "/subdir2")
});
```

This change provides better observability by allowing listeners to distinguish between clear operations on different subdirectories within the SharedDirectory hierarchy.
2 changes: 1 addition & 1 deletion packages/dds/map/api-report/map.legacy.beta.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export interface ISharedDirectory extends ISharedObject<ISharedDirectoryEvents &
// @beta @sealed @legacy
export interface ISharedDirectoryEvents extends ISharedObjectEvents {
(event: "valueChanged", listener: (changed: IDirectoryValueChanged, local: boolean, target: IEventThisPlaceHolder) => void): any;
(event: "clear", listener: (local: boolean, target: IEventThisPlaceHolder) => void): any;
(event: "clear", listener: (path: string, local: boolean, target: IEventThisPlaceHolder) => void): any;
(event: "subDirectoryCreated", listener: (path: string, local: boolean, target: IEventThisPlaceHolder) => void): any;
(event: "subDirectoryDeleted", listener: (path: string, local: boolean, target: IEventThisPlaceHolder) => void): any;
}
Expand Down
7 changes: 6 additions & 1 deletion packages/dds/map/src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,16 @@ export interface ISharedDirectoryEvents extends ISharedObjectEvents {
*
* @remarks Listener parameters:
*
* - `path` - The absolute path to the directory that was cleared.
*
* - `local` - Whether the clear originated from this client.
*
* - `target` - The {@link ISharedDirectory} itself.
*/
(event: "clear", listener: (local: boolean, target: IEventThisPlaceHolder) => void);
(
event: "clear",
listener: (path: string, local: boolean, target: IEventThisPlaceHolder) => void,
);
Comment on lines +164 to +167
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

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

The interface signature has been updated to include a path parameter as the first argument, but the actual implementation in directory.ts does not emit this parameter. The emit calls at lines 1572, 1584, and 1911 in directory.ts still use the old signature emit("clear", local, this.directory) instead of the new signature emit("clear", this.absolutePath, local, this.directory). This means the interface change is not implemented in the actual code, causing a runtime mismatch between what listeners expect and what is actually emitted.

Copilot uses AI. Check for mistakes.

/**
* Emitted when a subdirectory is created.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ export interface ISharedDirectory extends ISharedObject<ISharedDirectoryEvents &
// @beta @sealed @legacy
export interface ISharedDirectoryEvents extends ISharedObjectEvents {
(event: "valueChanged", listener: (changed: IDirectoryValueChanged, local: boolean, target: IEventThisPlaceHolder) => void): any;
(event: "clear", listener: (local: boolean, target: IEventThisPlaceHolder) => void): any;
(event: "clear", listener: (path: string, local: boolean, target: IEventThisPlaceHolder) => void): any;
(event: "subDirectoryCreated", listener: (path: string, local: boolean, target: IEventThisPlaceHolder) => void): any;
(event: "subDirectoryDeleted", listener: (path: string, local: boolean, target: IEventThisPlaceHolder) => void): any;
}
Expand Down
Loading