Skip to content

Commit

Permalink
feature(inspector) Data Tracing Now Handles Spread Values (#5694)
Browse files Browse the repository at this point in the history
- Added `DataPathSuccess`, `DataPathNotPossible` and `DataPathUnavailable` types
  along with some union types for them.
- Added `combinePositiveResults` as an alternative to manually combining spread arrays.
- Refactor `processJSPropertyAccessors` to handle `DataPathPositiveResult`.
- `findPathToIdentifier` now caters for the spread operators.
  • Loading branch information
seanparsons authored May 17, 2024
1 parent 41eb791 commit a2c5dd0
Show file tree
Hide file tree
Showing 4 changed files with 327 additions and 162 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { DataCartoucheInner } from './data-reference-cartouche'
import { NO_OP } from '../../../../core/shared/utils'
import type { ElementPath, PropertyPath } from '../../../../core/shared/project-file-types'
import * as EPP from '../../../template-property-path'
import { traceDataFromProp } from '../../../../core/data-tracing/data-tracing'
import { dataPathSuccess, traceDataFromProp } from '../../../../core/data-tracing/data-tracing'
import { Substores, useEditorState } from '../../../editor/store/store-hook'

interface IdentifierExpressionCartoucheControlProps {
Expand All @@ -31,7 +31,7 @@ export const IdentifierExpressionCartoucheControl = React.memo(
EPP.create(props.elementPath, props.propertyPath),
store.editor.jsxMetadata,
store.editor.projectContents,
[],
dataPathSuccess([]),
).type === 'hook-result',
'IdentifierExpressionCartoucheControl trace',
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { useDataPickerButton } from './component-section'
import { useDispatch } from '../../../editor/store/dispatch-context'
import { selectComponents } from '../../../editor/actions/meta-actions'
import { when } from '../../../../utils/react-conditionals'
import { traceDataFromElement } from '../../../../core/data-tracing/data-tracing'
import { dataPathSuccess, traceDataFromElement } from '../../../../core/data-tracing/data-tracing'
import type { DataPickerType } from './data-picker-popup'
import type { RenderedAt } from '../../../editor/store/editor-state'

Expand Down Expand Up @@ -52,7 +52,7 @@ export const DataReferenceCartoucheControl = React.memo(
props.surroundingScope,
store.editor.jsxMetadata,
store.editor.projectContents,
[],
dataPathSuccess([]),
)
},
'IdentifierExpressionCartoucheControl trace',
Expand Down
Loading

0 comments on commit a2c5dd0

Please sign in to comment.