Skip to content

Commit

Permalink
feat(spec): add new specJS selector (#8936)
Browse files Browse the repository at this point in the history
This selector always returns the same JavaScript
object unless it really changes.

Before this change it customary to call
specJson().toJS() which always resulted
in transformation operation and new JavaScript
object.

Refs #8606
  • Loading branch information
char0n authored Jun 16, 2023
1 parent f443c58 commit a6c2745
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/core/plugins/err/error-transformers/hook.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const errorTransformers = [

export default function transformErrors (errors) {
// Dev note: unimplemented artifact where
// jsSpec: system.specSelectors.specJson().toJS()
// jsSpec: system.specSelectors.specJS()
// regardless, to be compliant with redux@4, instead of calling the store method here,
// jsSpec should be pass down as an argument,
let inputs = {
Expand Down
2 changes: 1 addition & 1 deletion src/core/plugins/spec/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ const debResolveSubtrees = debounce(async () => {
}
}, Promise.resolve({
resultMap: (specSelectors.specResolvedSubtree([]) || Map()).toJS(),
specWithCurrentSubtrees: specSelectors.specJson().toJS()
specWithCurrentSubtrees: specSelectors.specJS()
}))

delete requestBatch.system
Expand Down
5 changes: 5 additions & 0 deletions src/core/plugins/spec/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ export const specJson = createSelector(
spec => spec.get("json", Map())
)

export const specJS = createSelector(
specJson,
(spec) => spec.toJS()
)

export const specResolved = createSelector(
state,
spec => spec.get("resolved", Map())
Expand Down

0 comments on commit a6c2745

Please sign in to comment.