feat: implement ability to search when selecting datasets - #153
Conversation
…task/implement-search-in-dataset-selector
There was a problem hiding this comment.
🟡 Changes recommended
The shared selector has unresolved chart reset and duplicate metadata-loading issues, plus an unused import.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds a reusable searchable dataset selector across visualization blocks and map layers.
Changes:
- Introduces and exports
DatasetSelector. - Replaces existing dataset controls.
- Updates dependencies and adds a changeset.
File summaries
| File | Summary |
|---|---|
pnpm-lock.yaml |
Updates workspace dependency metadata. |
plugins/wp-react-blocks-plugin/blocks/package.json |
Updates the commons dependency. |
plugins/wp-react-blocks-plugin/blocks/map/BlockEdit.js |
Integrates the shared selector. |
plugins/wp-react-blocks-plugin/blocks/grouped-bars/BlockEdit.js |
Integrates the shared selector. |
plugins/wp-react-blocks-plugin/blocks/filter/BlockEdit.js |
Integrates the shared selector. |
plugins/wp-react-blocks-plugin/blocks/data-paragraph/BlockEdit.js |
Integrates the shared selector. |
plugins/wp-react-blocks-plugin/blocks/d3Map/layers/LatLong.jsx |
Integrates the shared selector. |
plugins/wp-react-blocks-plugin/blocks/d3Map/layers/Flow.jsx |
Integrates the shared selector. |
plugins/wp-react-blocks-plugin/blocks/d3Map/layers/Data.jsx |
Integrates the shared selector. |
plugins/wp-react-blocks-plugin/blocks/charts/BlockEdit.js |
Integrates the shared selector. |
plugins/wp-react-blocks-plugin/blocks/big-number/BlockEdit.js |
Integrates the shared selector. |
plugins/wp-react-blocks-plugin/blocks/big-number-trend/BlockEdit.js |
Integrates the shared selector. |
plugins/wp-react-blocks-plugin/blocks/big-filter/BlockEdit.js |
Integrates the shared selector. |
packages/commons/src/index.js |
Exports DatasetSelector. |
packages/commons/src/DatasetSelector.jsx |
Implements searchable dataset selection. |
.changeset/sixty-queens-invent.md |
Documents the commons package release. |
Review details
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
- Files reviewed: 15/16 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
4242c5b to
3b2415a
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved selector integration, stale dataset state, loading-state, and unused-import issues remain.
Get a fresh assessment by requesting another Copilot review.
Review details
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
Suppressed comments (11)
packages/commons/src/DatasetSelector.jsx:9
- This selector is only wired into
map/BlockEdit;grouped-bars/BlockEdit.jsanddata-paragraph/BlockEdit.jsstill render the oldSelectControlfor Superset datasets, so users of those blocks still cannot search. Please update those dataset controls as part of this feature or narrow the feature scope.
export const DatasetSelector = (props) => {
const {
setAttributes,
setState,
loadMetadata,
packages/commons/src/index.js:45
- The new selector is not wired into all existing Superset dataset pickers:
data-paragraph/BlockEdit.js:198-205andgrouped-bars/BlockEdit.js:353-365still renderSelectControl, so those blocks cannot search datasets. Please migrate those call sites as well, or narrow the feature scope in the PR description.
export { DatasetSelector } from './DatasetSelector';
plugins/wp-react-blocks-plugin/blocks/big-filter/BlockEdit.js:169
datasetsalways contains theSelect Datasetsentinel, so this length check is never zero while the API request is pending. Consequently the new combobox never shows its loading state; check the rawthis.state.datasets(or an explicit loading flag) instead.
isLoading={datasets.length === 0}
plugins/wp-react-blocks-plugin/blocks/big-number-trend/BlockEdit.js:162
datasetsalways contains theSelect Datasetsentinel, so this length check is never zero while the API request is pending. Consequently the new combobox never shows its loading state; check the rawthis.state.datasets(or an explicit loading flag) instead.
isLoading={datasets.length === 0}
plugins/wp-react-blocks-plugin/blocks/big-number/BlockEdit.js:144
datasetsalways contains theSelect Datasetsentinel, so this length check is never zero while the API request is pending. Consequently the new combobox never shows its loading state; check the rawthis.state.datasets(or an explicit loading flag) instead.
isLoading={datasets.length === 0}
plugins/wp-react-blocks-plugin/blocks/charts/BlockEdit.js:421
datasetsalways contains theSelect Datasetsentinel, so this length check is never zero while the API request is pending. Consequently the new combobox never shows its loading state; check the rawthis.state.datasets(or an explicit loading flag) instead.
isLoading={datasets.length === 0}
plugins/wp-react-blocks-plugin/blocks/d3Map/layers/Data.jsx:314
- This layer also prepends a
Select Datasetoption, soallDatasets.length === 0is never true and the combobox cannot indicate that metadata is still loading. Pass an explicit loading state from the metadata owner instead of deriving it from this placeholder-inclusive list.
isLoading={allDatasets.length === 0}
plugins/wp-react-blocks-plugin/blocks/d3Map/layers/Flow.jsx:294
- This layer also prepends a
Select Datasetoption, soallDatasets.length === 0is never true and the combobox cannot indicate that metadata is still loading. Pass an explicit loading state from the metadata owner instead of deriving it from this placeholder-inclusive list.
isLoading={allDatasets.length === 0}
plugins/wp-react-blocks-plugin/blocks/d3Map/layers/LatLong.jsx:255
- This layer also prepends a
Select Datasetoption, soallDatasets.length === 0is never true and the combobox cannot indicate that metadata is still loading. Pass an explicit loading state from the metadata owner instead of deriving it from this placeholder-inclusive list.
isLoading={allDatasets.length === 0}
plugins/wp-react-blocks-plugin/blocks/filter/BlockEdit.js:260
datasetsalways contains theSelect Datasetsentinel, so this length check is never zero while the API request is pending. Consequently the new combobox never shows its loading state; check the rawthis.state.datasets(or an explicit loading flag) instead.
isLoading={datasets.length === 0}
plugins/wp-react-blocks-plugin/blocks/map/BlockEdit.js:12
ComboboxControlis imported here but the file now renders the sharedDatasetSelectorinstead, so this named import is unused and will fail the repository's lint rules. Remove it from the import list.
ComboboxControl,
- Files reviewed: 14/15 changed files
- Comments generated: 4
- Review effort level: Lite
| app, | ||
| datasets | ||
| } = props; | ||
| const [ filterValue, setFilterValue ] = useState(""); |
| onChange={(newDatasetId) => { | ||
| onChangeProperty("dvzProxyDatasetId", newDatasetId) | ||
| }} | ||
| options={this.state.filteredDatasets || allDatasets} |
| onChange={(newDatasetId) => { | ||
| onChangeProperty("dvzProxyDatasetId", newDatasetId) | ||
| }} | ||
| options={this.state.filteredDatasets || allDatasets} |
| onChange={(newDatasetId) => { | ||
| onChangeProperty("dvzProxyDatasetId", newDatasetId) | ||
| }} | ||
| options={this.state.filteredDatasets || allDatasets} |
…set-selector feat: implement ability to search when selecting datasets
Description
Type of change
fix:)feat:)BREAKING CHANGE:)refactor:/chore:)docs:)Affected package(s)
@devgateway/dvz-wp-commons@devgateway/create-wp-customizer@devgateway/upgrade-wp-customizerplugins/wp-react-blocks-pluginplugins/wp-react-custom-apiplugins/wp-react-custom-rest-menuChecklist
pnpm buildpasses locally