Contents
- ✨ New Features
- Latest and LatestMap support more types (#24417)
- 🌳 SharedTree DDS Changes
- Improve handling of deleted nodes (#24345)
- allowUnused utility function (#24076)
- Typing derived from unions of AllowedTypes arrays is fixed (#24441)
- Remote edits to nodes which have never been accessed locally correctly trigger "treeChanged" events (#24421)
- "Unsafe" @system types moved to System_Unsafe namespace (#24443)
- ⚠️ Deprecations
- Generic types for IntervalCollections have been replaced with non-generic types (#24164)
- Other Changes
- Presence APIs have been renamed (#24384)
- Presence object is accessible from Workspaces and State objects (#24396)
- StateFactory.latest/latestMap take an object as its only argument (#24414)
✨ New Features
Latest and LatestMap support more types (#24417)
Latest(StateFactory.latest) permitsnullso that nullable types may be used.LatestMap(StateFactory.latestMap) permitsboolean,number,string, andnull.
Change details
Commit: 619af0b
Affected packages:
- @fluidframework/presence
⬆️ Table of contents
🌳 SharedTree DDS Changes
Improve handling of deleted nodes (#24345)
TreeNodes which are deleted were not handled correctly. This has been improved in two ways:
- Accessing fields of deleted nodes now consistently throws a usage error indicating that doing so is invalid. Previously, this would throw an assertion error, which was a bug.
- When a
TreeNodeis deleted, but that node still exists within theITree, then becomes accessible again later, a newTreeNodeis now allocated instead of trying to reuse the deleted one. Note that this can only happen when the entire view of theITreeis disposed then recreated. This happens when disposing and recreating a TreeView or when the contents of the view are disposed due to being out of schema (another client did a schema upgrade), then brought back into schema (the schema upgrade was undone).
Change details
Commit: 0ab3e51
Affected packages:
- @fluidframework/tree
- fluid-framework
⬆️ Table of contents
allowUnused utility function (#24076)
A new allowUnused utility function has been added, which discards its type or runtime argument. When TypeScript is configured to reject code with unused locals, this function can be used to suppress that error, enabling use of ValidateRecursiveSchema to compile.
class Test extends sf.arrayRecursive("Test", () => Test) {} // Bad
allowUnused<ValidateRecursiveSchema<typeof Test>>(); // Reports compile error due to invalid schema above.Change details
Commit: 13c62b6
Affected packages:
- @fluidframework/tree
- fluid-framework
⬆️ Table of contents
Typing derived from unions of AllowedTypes arrays is fixed (#24441)
Unions of array types provided as an AllowedTypes used to result in incorrectly computed insertable content types. This happened because InsertableTreeNodeFromAllowedTypes distributed over the union, violating the policy documented in Input for how schema-derived input types should be computed. This has been fixed. To get usable Input types, SharedTree schema's types should always capture the exact schema provided at runtime and not unions of possible different schema. Any code impacted by this change should be updated to replace any such unions with more specific types.
Change details
Commit: a27ef0a
Affected packages:
- fluid-framework
- @fluidframework/tree
⬆️ Table of contents
Remote edits to nodes which have never been accessed locally correctly trigger "treeChanged" events (#24421)
There was a bug where "treeChanged" events would not always trigger if the node that was edited had never been accessed in the current view. This has been fixed.
Change details
Commit: 916ad05
Affected packages:
- @fluidframework/tree
- fluid-framework
⬆️ Table of contents
"Unsafe" @System types moved to System_Unsafe namespace (#24443)
Working code conforming to the rules regarding API Support Levels should be unaffected, but this resolves an issue which required violating these rules and directly referencing @system types.
Sometimes packages exporting SharedTree schema related types for recursive schema could yield errors like:
error TS2742: The inferred type of 'YourSchema' cannot be named without a reference to '../node_modules/@fluidframework/tree/lib/internalTypes.js'. This is likely not portable. A type annotation is necessary.
Mitigating this error could require explicitly referencing these @system types from internalTypes. Any such references to the moved types should be able to be deleted, as TypeScript will now be able to find them in the new namespace without assistance.
This does not migrate all types out of internalTypes, so some occurrences of this issue may remain.
Change details
Commit: dd4abfc
Affected packages:
- fluid-framework
- @fluidframework/tree
⬆️ Table of contents
⚠️ Deprecations
Generic types for IntervalCollections have been replaced with non-generic types (#24164)
This change deprecates the following generic types and provides non-generic alternatives where necessary:
IIntervalCollectionis replaced byISequenceIntervalCollectionIIntervalCollectionEventis replaced byISequenceIntervalCollectionEventsIntervalIndexis replaced bySequenceIntervalIndexIOverlappingIntervalsIndexis replaced byISequenceOverlappingIntervalsIndexISharedIntervalCollectionis deprecated without replacement
These types are no longer required to be generic, and replacing them with non-generic alternatives keeps our typing less complex.
Change details
Commit: 280e2bc
Affected packages:
- fluid-framework
- @fluidframework/sequence
⬆️ Table of contents
Other Changes
Presence APIs have been renamed (#24384)
The following API changes have been made to improve clarity and consistency:
| Before 2.33.0 | 2.33.0 |
|---|---|
acquirePresence
| getPresence
|
acquirePresenceViaDataObject
| getPresenceViaDataObject
|
ClientSessionId
| AttendeeId
|
IPresence
| Presence
|
IPresence.events["attendeeJoined"]
| Presence.attendees.events["attendeeConnected"]
|
IPresence.events["attendeeDisconnected"]
| Presence.attendees.events["attendeeDisconnected"]
|
IPresence.getAttendee
| Presence.attendees.getAttendee
|
IPresence.getAttendees
| Presence.attendees.getAttendees
|
IPresence.getMyself
| Presence.attendees.getMyself
|
IPresence.getNotifications
| Presence.notifications.getWorkspace
|
IPresence.getStates
| Presence.states.getWorkspace
|
ISessionClient
| Attendee
|
Latest (import)
| StateFactory
|
Latest (call)
| StateFactory.latest
|
LatestEvents.updated
| LatestRawEvents.remoteUpdated
|
LatestMap (import)
| StateFactory
|
LatestMap (call)
| StateFactory.latestMap
|
LatestMapEvents.itemRemoved
| LatestMapRawEvents.remoteItemRemoved
|
LatestMapEvents.itemUpdated
| LatestMapRawEvents.remoteItemUpdated
|
LatestMapEvents.updated
| LatestMapRawEvents.remoteUpdated
|
LatestMapItemValueClientData
| LatestMapItemUpdatedClientData
|
LatestMapValueClientData
| LatestMapClientData
|
LatestMapValueManager
| LatestMapRaw
|
LatestMapValueManager.clients
| LatestMapRaw.getStateAttendees
|
LatestMapValueManager.clientValue
| LatestMapRaw.getRemote
|
LatestMapValueManager.clientValues
| LatestMapRaw.getRemotes
|
LatestMapValueManagerEvents
| LatestMapRawEvents
|
LatestValueClientData
| LatestClientData
|
LatestValueData
| LatestData
|
LatestValueManager
| LatestRaw
|
LatestValueManager.clients
| LatestRaw.getStateAttendees
|
LatestValueManager.clientValue
| LatestRaw.getRemote
|
LatestValueManager.clientValues
| LatestRaw.getRemotes
|
LatestValueManagerEvents
| LatestRawEvents
|
LatestValueMetadata
| LatestMetadata
|
PresenceEvents.attendeeDisconnected
| AttendeesEvents.attendeeDisconnected
|
PresenceEvents.attendeeJoined
| AttendeesEvents.attendeeConnected
|
PresenceNotifications
| NotificationsWorkspace
|
PresenceNotifications.props
| NotificationsWorkspace.notifications
|
PresenceNotificationsSchema
| NotificationsWorkspaceSchema
|
PresenceStates
| StatesWorkspace
|
PresenceStates.props
| StatesWorkspace.states
|
PresenceStatesEntries
| StatesWorkspaceEntries
|
PresenceStatesSchema
| StatesWorkspaceSchema
|
PresenceWorkspaceAddress
| WorkspaceAddress
|
PresenceWorkspaceEntry
| StatesWorkspaceEntry
|
SessionClientStatus
| AttendeeStatus
|
ValueMap
| StateMap
|
Note
To fully replace the former Latest and LatestMap functions, you should import StateFactory and call StateFactory.latest and StateFactory.latestMap respectively. The new LatestRaw and LatestMapRaw APIs replace LatestValueManager and LatestMapValueManager respectively.
Change details
Commit: ea95ef0
Affected packages:
- @fluidframework/presence
⬆️ Table of contents
Presence object is accessible from Workspaces and State objects (#24396)
Users can now access the Presence object through .presence on all Workspaces and State objects:
Latest.presence LatestMap.presence Notifications.presence NotificationsWorkspace.presence StatesWorkspace.presence
Change details
Commit: c056567
Affected packages:
- @fluidframework/presence
⬆️ Table of contents
StateFactory.latest/latestMap take an object as its only argument (#24414)
The StateFactory.latest and StateFactory.latestMap functions now take a single object argument. To convert existing code, pass any initial data in the local argument and broadcast settings in the settings argument. For example:
Before:
const statesWorkspace = presence.states.getWorkspace("name:workspace", {
cursor: StateFactory.latest(
{ x: 0, y: 0 },
{ allowableUpdateLatencyMs: 100 },
),
});After:
const statesWorkspace = presence.states.getWorkspace("name:workspace", {
cursor: StateFactory.latest({
local: { x: 0, y: 0 },
settings: { allowableUpdateLatencyMs: 100 },
}),
});Change details
Commit: 446d418
Affected packages:
- @fluidframework/presence
⬆️ Table of contents
🛠️ Start Building Today!
Please continue to engage with us on GitHub Discussion and Issue pages as you adopt Fluid Framework!