IViewConverter Interface

Packages > @fluidframework/react > IViewConverter

View converters to take the synced state Fluid value that they are keyed against in the FluidToView map and convert them into their view state counterparts

Signature:

export interface IViewConverter<SV extends IViewState, SF extends IFluidState> 

Properties

List of properties of this interface
Property Type Description
listenedEvents string[] List of events fired on this Fluid object that will trigger a state update
rootKey string If this Fluid object is stored on the Fluid DataObject root under a different key than the name of this Fluid state key within the synced state map, provide the key on the root for this object here. The changes will also reflect under that key if the data needs to be used elsewhere
sharedObjectCreate (runtime: IFluidDataStoreRuntime) => any If this is a fluid DDS SharedObject type (i.e. SharedCounter, SharedMap), supply its create function here and add any events that it will fire to the listenedEvents param below to trigger state updates
type string The type of object this key in the Fluid state holds
viewConverter (viewState: SV, fluidState: Partial, fluidObjectMap: FluidObjectMap) => Partial A callback that takes in the partial Fluid state containing the value that this converter maps to, and returns the corresponding partial view state
viewKey keyof SV The corresponding value key within the view state type

Events

listenedEvents

List of events fired on this Fluid object that will trigger a state update

Signature:

listenedEvents?: string[];

rootKey

If this Fluid object is stored on the Fluid DataObject root under a different key than the name of this Fluid state key within the synced state map, provide the key on the root for this object here. The changes will also reflect under that key if the data needs to be used elsewhere

Signature:

rootKey?: string;

sharedObjectCreate

If this is a fluid DDS SharedObject type (i.e. SharedCounter, SharedMap), supply its create function here and add any events that it will fire to the listenedEvents param below to trigger state updates

Signature:

sharedObjectCreate?: (runtime: IFluidDataStoreRuntime) => any;

type

The type of object this key in the Fluid state holds

Signature:

type: string;

viewConverter

A callback that takes in the partial Fluid state containing the value that this converter maps to, and returns the corresponding partial view state

Signature:

viewConverter?: (viewState: SV, fluidState: Partial<SF>, fluidObjectMap: FluidObjectMap) => Partial<SV>;

viewKey

The corresponding value key within the view state type

Signature:

viewKey: keyof SV;