Skip to main content

sdk.loadingcardapi.updateloadingcard

Home > @kittl/sdk > LoadingCardAPI > updateLoadingCard

LoadingCardAPI.updateLoadingCard() method

Updates an existing loading card with new properties or progress information.

This method modifies the properties of an existing loading card, typically to update progress information, adjust positioning, or modify metadata during an ongoing operation. Loading cards are often updated multiple times during their lifecycle to reflect progress, timing changes, or repositioning needs.

**Updatable Properties:** - Position (absolute coordinates or relative positioning) - Size (with automatic scale recalculation and viewport scaling) - Generation metadata (IDs, timing, model information) - Performance metrics and progress tracking data - Custom naming for organization

**Common Update Scenarios:** - Progress updates during long-running operations - Position adjustments due to layout changes - Metadata updates when switching between generation models - Performance metric updates for speed tracking - Name changes for better organization during development

**Performance Considerations:** - Batch multiple updates using the batchClient option for better performance - Avoid frequent position updates if the loading card will be replaced soon - Use volatile origin for transient updates that don't need history tracking

Signature:

updateLoadingCard(input: UpdateLoadingCardInput, opts?: DesignApiOptions): NormalizedLoadingCardObject;

Parameters

Parameter

Type

Description

input

UpdateLoadingCardInput

Loading card update configuration

opts

DesignApiOptions

(Optional) Optional execution configuration controlling patch behavior and change tracking

Returns:

NormalizedLoadingCardObject

The updated loading card object with all applied changes

Exceptions

When loading card with specified ID is not found

When target object is not a loading card type

When position calculation fails

When size constraints are violated

When metadata updates are malformed

Example

// Update loading card position
const updated = api.updateLoadingCard({
id: 'loading-123',
position: { absolute: { left: 150, top: 100 } }
});

// Update generation progress and metadata
api.updateLoadingCard({
id: 'loading-123',
generationAverageSpeed: 3.2,
generatingModelKey: 'improved-model-v2'
});

// Batch multiple loading card updates
const batchClient = designController.createBatchClient();
api.updateLoadingCard({ id: 'loader-1', name: 'Updated Loader' }, { batchClient });
api.updateLoadingCard({ id: 'loader-2', generationAverageSpeed: 4.1 }, { batchClient });
batchClient.commit();