Skip to content

Removal of Loader class #24450

@MarioJGMsoft

Description

@MarioJGMsoft

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.

Metadata

Metadata

Assignees

Labels

breaking changeThis PR or issue would introduce a breaking change

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions