Skip to content

Commit

Permalink
enhance: Reorder action members for easier readability
Browse files Browse the repository at this point in the history
  • Loading branch information
ntucker committed Jul 18, 2024
1 parent 80c3323 commit 06df291
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 6 deletions.
9 changes: 9 additions & 0 deletions .changeset/violet-gorillas-provide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@data-client/core': patch
'@data-client/react': patch
---

Reorder action members for easier debuggability

- `key` at top - easiest to read 'subject'
- `response` or `value` after - 'object' being set
2 changes: 1 addition & 1 deletion packages/core/src/controller/actions/createFetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ export function createFetch<

return {
type: FETCH_TYPE,
key: endpoint.key(...args),
endpoint,
args,
key: endpoint.key(...args),
meta,
};
}
2 changes: 1 addition & 1 deletion packages/core/src/controller/actions/createOptimistic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ export function createOptimistic<

return {
type: OPTIMISTIC_TYPE,
key: endpoint.key(...args),
endpoint,
args,
key: endpoint.key(...args),
meta: createMeta(endpoint.dataExpiryLength ?? 60000, fetchedAt),
};
}
2 changes: 1 addition & 1 deletion packages/core/src/controller/actions/createSet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ export function createSet<S extends Queryable>(
): SetAction<S> {
return {
type: SET_TYPE,
schema,
value,
schema,
args: args.map(ensurePojo) as SchemaArgs<S>,
meta: createMeta(60000, fetchedAt),
};
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/controller/actions/createSetResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ export function createSetResponse<

return {
type: SET_RESPONSE_TYPE,
endpoint,
key: endpoint.key(...args),
response,
endpoint,
args: args.map(ensurePojo),
key: endpoint.key(...args),
meta: createMeta(expiryLength, fetchedAt),
error,
};
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/controller/actions/createSubscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ export function createUnsubscription<E extends EndpointInterface>(
): UnsubscribeAction<E> {
return {
type: UNSUBSCRIBE_TYPE,
key: endpoint.key(...args),
endpoint,
args,
key: endpoint.key(...args),
};
}

0 comments on commit 06df291

Please sign in to comment.