Export the feature-row classification alongside the points feature state - #146
Conversation
`usePointsFeatureState` hands back the raw engine signals for a feature — resident, rendered, scanning, whether the element supports an on-demand scan — and `describeFeatureRowState` is what reads them: dimmed or not, a short label, and the sentence explaining why. Only the first half was reachable from the package entry, so an embedder building its own feature list got the data without the reading of it, and had to re-derive a precedence (resident/rendered beat selection and scan state) whose failure mode is a panel greying a feature the canvas is drawing. No behaviour change; these already backed the built-in feature filter panel. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 46 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Follow-on to #144, found while building the equivalent points feature UI in MDV against the published
0.7.0.The gap
#144 exported
usePointsFeatureState, which returns the raw engine signals for a layer:residentCodes,loadedMatchingCodes,matchingLoadState,supportsOnDemandLoad. What it does not export is the thing that reads those signals.describeFeatureRowStatetakes the six booleans a feature list already has and returns the row's rendered state —greyed, a shortlabel, and a sentence explaining why — with a precedence that is not obvious from the outside:resident/rendered(its points are in memory) beat selection and scan state;cached, not dropped, because deselecting filters the in-memory batch rather than re-scanning;!residentKnownmeans "can't distinguish", which has to read as shown, not as not loaded.Get that order wrong and the panel greys a feature the canvas is currently drawing. That is exactly the class of divergence the built-in panel's comment calls out ("drives both the dimming and the diagnostic tooltip so they can never disagree") — but only for consumers who can reach the function.
What this adds
Values:
describeFeatureRowState,featureRowOpacity.Types:
FeatureRowState,FeatureRowStateInput,FeatureRowTone.Both were already exported from
featureRowState.ts; this re-exports them throughSpatialCanvas/public.tsand the package entry, which is the only route out (the package publishes just a"."export). No behaviour change —PointsFeatureFilterPanelis already the caller.The module was deliberately split out of the panel file so it exports no component (a mixed component + plain-function export breaks Fast Refresh for that file). Re-exporting through
public.tskeeps that split intact.Verification
pnpm --filter @spatialdata/vis build, then imported the builtdist/index.js: both values resolve as functions, and callingdescribeFeatureRowStatewith a selected+scanning row returns{tone: "loading", greyed: true, …}withfeatureRowOpacity0.6. Types present indist/index.d.ts.pnpm --filter @spatialdata/vis test— 149 tests, 16 files, passing.Minor changeset included.