FluidFramework icon indicating copy to clipboard operation
FluidFramework copied to clipboard

Removal of `Loader` class

Open MarioJGMsoft opened this issue 8 months ago • 1 comments

The Loader class from the @fluidframework/container-loader package is deprecated and for internal use only.

Context

The Loader class doesn't do much and can easily be replaced with several free functions. This would be more maintainable than managing a class as classes bring additional maintenance burden.

Approach

The current functions that are available through the Loader class are:

  • createDetachedContainer
  • rehydrateDetachedContainerFromSnapshot
  • resolve

These 3 functions have been added as free-form functions in the @fluidframework/container-loaderpackage. Following are the new equivalent functions for each of the current ones:

Loader Class Function Free-form Function
loader.createDetachedContainer(
codeDetails: IFluidCodeDetails,
createDetachedProps?: { canReconnect?: boolean;
clientDetailsOverride?: IClientDetails; }): Promise<IContainer>
createDetachedContainer(
createDetachedContainerProps: ICreateDetachedContainerProps) : Promise<IContainer>
loader.rehydrateDetachedContainerFromSnapshot(
snapshot: string,
createDetachedProps?: {
canReconnect?: boolean;
clientDetailsOverride?: IClientDetails; }): Promise<IContainer>
rehydrateDetachedContainer(
rehydrateDetachedContainerProps: IRehydrateDetachedContainerProps): Promise<IContainer>
loader.resolve(
request: IRequest,
pendingLocalState?: string): Promise<IContainer>
loadExistingContainer(
loadExistingContainerProps: ILoadExistingContainerProps): Promise<IContainer>

It's important to note that the variables used when a Loader object is initialized are now going to be sent through the ...Props interfaces of the functions (See more about each interface: ICreateAndLoadContainerProps, ICreateDetachedContainerProps, IRehydrateDetachedContainerProps, ILoadExistingContainerProps).

Packages

@fluidframework/container-loader

Expected Timeline

To be removed in version 2.60 or later.

MarioJGMsoft avatar Apr 24 '25 18:04 MarioJGMsoft

This issue has been automatically marked as stale because it has had no activity for 180 days. It will be closed if no further activity occurs within 8 days of this comment. Thank you for your contributions to Fluid Framework!