useStructuredDevicesProps(selector: (structuredDevicesProps: { [key: string]: Record<string, any> }) => any;, equalityFn?: (prev: any, next: any) => boolean;)
Requires:
@ray-js/panel-sdk≥1.16.0
Before use, both of the following must be met:Read the full notes
Before use, both of the following must be met:
1. Mount SdmDevicesProvider and configure the associated device mapping
2. Each device has configured the dp-kit interceptor (createDpKit) during initialization
Performance optimization (best practices):
1. Strongly recommend always scoping the selector to the exact feature point, e.g., useStructuredDevicesProps(props => props.main?.colour_data), to avoid full subscriptions that cause unnecessary rerenders when unrelated devices or feature points change.
2. If the selector must return an object containing multiple fields, the default shallow comparison (shallow equal) ensures rerender will not be triggered as long as the extracted values do not change. If needed, pass a custom equalityFn for fine-grained control.
1. Mount SdmDevicesProvider and configure the associated device mapping
2. Each device has configured the dp-kit interceptor (createDpKit) during initialization
Performance optimization (best practices):
1. Strongly recommend always scoping the selector to the exact feature point, e.g., useStructuredDevicesProps(props => props.main?.colour_data), to avoid full subscriptions that cause unnecessary rerenders when unrelated devices or feature points change.
2. If the selector must return an object containing multiple fields, the default shallow comparison (shallow equal) ensures rerender will not be triggered as long as the extracted values do not change. If needed, pass a custom equalityFn for fine-grained control.
Description
Get the structured DP state of associated devices; requires the dp-kit interceptor
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
selector | (structuredDevicesProps: { [key: string]: Record<string, any> }) => any; | Yes | Selector function. Input: the collection of structured props for all associated devices. The key is the device identifier, and the value is the device’s structured DP data parsed by dp-kit |
equalityFn | (prev: any, next: any) => boolean; | No | Custom comparison function; if it returns true, re-render is not triggered; default is shallow equal |
Return Value
Type: any
Structured DP value matching the selector