Skip to content

Commit

Permalink
Set expires at only when value is set
Browse files Browse the repository at this point in the history
  • Loading branch information
twschiller committed Sep 25, 2024
1 parent 7ff7b32 commit 1cd7433
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/bricks/transformers/controlFlow/WithCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,8 @@ export class WithCache extends TransformerABC {
// Initialize the mod variable.
await setModVariable({
requestId,
expiresAt,
// Don't set expiresAt until the value is set
expiresAt: null,
isLoading: true,
isFetching: true,
isSuccess: false,
Expand All @@ -332,7 +333,6 @@ export class WithCache extends TransformerABC {
// the state could have been deleted since the getState call. Therefore, pass a full state object
...currentVariable,
requestId,
expiresAt,
isFetching: true,
currentData: null,
});
Expand Down Expand Up @@ -379,6 +379,7 @@ export class WithCache extends TransformerABC {
data,
requestId,
error: null,
// Record expiresAt (if provided) when the value is set
expiresAt,
});

Expand Down

0 comments on commit 1cd7433

Please sign in to comment.