Skip to content

Commit 90a7f9b

Browse files
committed
chore: rename dynamic data to live data
1 parent 643e4be commit 90a7f9b

File tree

3 files changed

+17
-20
lines changed

3 files changed

+17
-20
lines changed

src/api/Action/Action.ts

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import {
2626

2727
const MULTI_VALUE_TYPES: ActionParameterType[] = ['checkbox'];
2828

29-
const EXPERIMENTAL_DYNAMIC_DATA_DEFAULT_DELAY_MS = 1000;
29+
const EXPERIMENTAL_LIVE_DATA_DEFAULT_DELAY_MS = 1000;
3030

3131
interface ActionMetadata {
3232
blockchainIds?: string[];
@@ -42,13 +42,13 @@ type ActionChainMetadata =
4242
isChained: false;
4343
};
4444

45-
interface DynamicData {
45+
interface LiveData {
4646
enabled: boolean;
4747
delayMs?: number;
4848
}
4949

5050
interface ExperimentalFeatures {
51-
dynamicData?: DynamicData;
51+
liveData?: LiveData;
5252
}
5353

5454
export class Action {
@@ -80,21 +80,18 @@ export class Action {
8080
}
8181

8282
// this API MAY change in the future
83-
public get dynamicData_experimental(): Required<DynamicData> | null {
84-
const dynamicData = this._experimental?.dynamicData;
83+
public get liveData_experimental(): Required<LiveData> | null {
84+
const liveData = this._experimental?.liveData;
8585

86-
if (!dynamicData) {
86+
if (!liveData) {
8787
return null;
8888
}
8989

9090
return {
91-
enabled: dynamicData.enabled,
92-
delayMs: dynamicData.delayMs
93-
? Math.max(
94-
dynamicData.delayMs,
95-
EXPERIMENTAL_DYNAMIC_DATA_DEFAULT_DELAY_MS,
96-
)
97-
: EXPERIMENTAL_DYNAMIC_DATA_DEFAULT_DELAY_MS,
91+
enabled: liveData.enabled,
92+
delayMs: liveData.delayMs
93+
? Math.max(liveData.delayMs, EXPERIMENTAL_LIVE_DATA_DEFAULT_DELAY_MS)
94+
: EXPERIMENTAL_LIVE_DATA_DEFAULT_DELAY_MS,
9895
};
9996
}
10097

src/api/actions-spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ export interface ActionError {
260260
// Dialect's extensions to the Actions API
261261
export interface DialectExperimentalFeatures {
262262
dialectExperimental?: {
263-
dynamicData?: {
263+
liveData?: {
264264
enabled: boolean;
265265
delayMs?: number; // default 1000 (1s)
266266
};

src/ui/ActionContainer.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -301,10 +301,10 @@ export const ActionContainer = ({
301301
}, [action, websiteUrl]);
302302

303303
useEffect(() => {
304-
const dynamicDataConfig = action.dynamicData_experimental;
304+
const liveDataConfig = action.liveData_experimental;
305305
if (
306-
!dynamicDataConfig ||
307-
!dynamicDataConfig.enabled ||
306+
!liveDataConfig ||
307+
!liveDataConfig.enabled ||
308308
executionState.status !== 'idle' ||
309309
action.isChained
310310
) {
@@ -322,15 +322,15 @@ export const ActionContainer = ({
322322
}
323323
} catch (e) {
324324
console.error(
325-
`[@dialectlabs/blinks] Failed to fetch dynamic data for action ${action.url}`,
325+
`[@dialectlabs/blinks] Failed to fetch live data for action ${action.url}`,
326326
);
327327
// if fetch failed, we retry after the same delay
328-
timeout = setTimeout(fetcher, dynamicDataConfig.delayMs);
328+
timeout = setTimeout(fetcher, liveDataConfig.delayMs);
329329
}
330330
};
331331

332332
// since either way we're rebuilding the whole action, we'll update and restart this effect
333-
timeout = setTimeout(fetcher, dynamicDataConfig.delayMs);
333+
timeout = setTimeout(fetcher, liveDataConfig.delayMs);
334334

335335
return () => {
336336
clearTimeout(timeout);

0 commit comments

Comments
 (0)