feat(spec): add new specJS selector (#8936)

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
This commit is contained in:
Vladimír Gorej
2023-06-16 13:37:10 +02:00
committed by GitHub
parent f443c58b70
commit a6c27457e5
3 changed files with 7 additions and 2 deletions

View File

@@ -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 = {

View File

@@ -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

View File

@@ -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())