Skip to content

Add shape fill-by-column controls and outline defaults - #39

Merged
xinaesthete merged 15 commits into
mainfrom
codex/add-shape-fill-by-column
Jun 2, 2026
Merged

Add shape fill-by-column controls and outline defaults#39
xinaesthete merged 15 commits into
mainfrom
codex/add-shape-fill-by-column

Conversation

@xinaesthete

@xinaesthete xinaesthete commented May 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add a shape fill-colour picker in SpatialCanvas that maps table-backed columns to per-feature fill colours.
  • Extend the shared shapes layer so fill-colour encoding also drives outlines, with configurable stroke width units and pixel clamps for tiny shapes.
  • Route shape tooltip and table-association handling through the updated shared helpers so the demo can work with layer-specific colour state.
  • Document the new layer/prop flow expectations, including Volta usage and the rule that multiple layers may target the same element with different visual properties.

Testing

  • Added and updated unit coverage for shape colour encoding, tooltip display, table association mapping, and shapes layer defaults.
  • Ran the @spatialdata/vis, @spatialdata/layers, and @spatialdata/core test suites locally.
  • Verified TypeScript and formatting checks for the touched packages passed.

Summary by CodeRabbit

  • New Features

    • Per-layer fill-color mapping from table columns (auto/categorical/continuous), stroke-width controls (units/min/max), and aggregate hover tooltips with multi-element sections.
    • New "Fill colour" panel in the Shapes properties UI.
  • Improvements

    • Richer tooltip content that preserves element context and aggregates picks; more stable caching for shape-derived rendering state and color handling.
    • Polygon stroke defaults updated to follow fill color.
  • Documentation

    • Expanded shapes, tooltip, performance, and working-norms guidance.
  • Tests

    • Added coverage for color encoding, tooltip merging, and feature-to-row alignment.

@coderabbitai

coderabbitai Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@xinaesthete, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 48 minutes and 14 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4af595d7-817d-426c-92ea-274b9ddbf49d

📥 Commits

Reviewing files that changed from the base of the PR and between 063d8e2 and 6e7458d.

📒 Files selected for processing (3)
  • docs/docs/vis/feature-table-associations.mdx
  • docs/docs/vis/overview.mdx
  • docs/docs/vis/spatial-canvas-status.mdx
📝 Walkthrough

Walkthrough

Adds per-column fill-color encoding, positional feature-row alignment, a shape feature-state runtime, hover-tooltip aggregation via DeckGL refs, a ShapeFillColorPanel UI, renderer/schema updates for stroke-width, async caching for derived fill-color state, tests, and documentation updates.

Changes

Multi-element shape visualization with fill colors and tooltip aggregation

Layer / File(s) Summary
Tooltip data model and table row alignment
packages/core/src/tooltip.ts, packages/core/src/tableAssociations.ts, packages/core/tests/tooltipDisplay.spec.ts, packages/core/tests/shapesRenderData.spec.ts
SpatialFeatureTooltipData now carries element context and optional sections; new helpers formatSpatialElementLabel, attachTooltipElementContext, and mergeSpatialFeatureTooltips added. loadFeatureRowIndexByFeatureIndex can align zero-based sequential featureIds to table rows by position.
Shapes feature-state runtime and color machinery
packages/layers/src/shapesLayer.ts, packages/layers/src/index.ts, packages/layers/src/spatialLayerProps.ts
Introduces buildShapeFeatureStateRuntime, EMPTY_SHAPE_FEATURE_STATE_RUNTIME, isShapeFeatureStateRuntime, stroke-width defaults/units, and resolveFeatureColor; normalizeShapeFeatureState/layer APIs updated and polygon stroke default now inherits fill color.
Shape fill-color encoding by table column
packages/vis/src/SpatialCanvas/shapeColorEncoding.ts, packages/vis/src/SpatialCanvas/types.ts, packages/vis/tests/shapeColorEncoding.spec.ts
Adds resolveShapeFillColorMode (auto→continuous/categorical) and buildShapeFillColorByFeatureId to produce per-feature RGBA maps from associated-table columns (numeric interpolation or categorical palette).
Hover tooltip aggregation and DeckGL ref threading
packages/vis/src/SpatialCanvas/featureTooltipHover.ts, packages/vis/src/SpatialCanvas/SpatialCanvasViewer.tsx, packages/vis/src/SpatialCanvas/SpatialViewer.tsx, packages/vis/src/SpatialCanvas/VivSpatialViewer.tsx, packages/vis/src/SpatialCanvas/SpatialFeatureTooltip.tsx, packages/vis/tests/featureTooltipHover.spec.ts
Adds resolveHoverFeatureTooltip to aggregate/deduplicate picks across layers using deck.pickMultipleObjects; extends options with pickLayerIds and dynamic pick depth; threads deckRef through viewer components; SpatialFeatureTooltip renders section-based payloads.
Shapes renderer configuration and stroke-width defaults
packages/vis/src/SpatialCanvas/renderers/shapesRenderer.ts
Extends ShapesLayerRenderConfig with strokeWidthUnits, strokeWidthMinPixels/MaxPixels, and featureStateRuntime; defaults sourced from layer constants and passed to createShapesDeckLayer.
Shape fill-color UI panel and layer property control
packages/vis/src/SpatialCanvas/ShapeFillColorPanel.tsx
Adds ShapeFillColorPanel component to select a column (or "None") for fillColorByColumn, emitting { columnName, mode: 'auto' } or undefined.
Canvas viewer integration and module export restructuring
packages/vis/src/SpatialCanvas/index.tsx, packages/vis/src/SpatialCanvas/public.ts, packages/vis/src/index.ts
Adds aggregateHoverTooltips prop to SpatialCanvas, introduces public.ts barrel exports, replaces shapes properties UI with ShapeFillColorPanel, and forwards deckRef for pick aggregation.
Async layer data pipeline for fill-color loading and caching
packages/vis/src/SpatialCanvas/useLayerData.ts
Extends loader to fetch associated rows for fill-color, computes stable signatures, caches per-layer shapeFillColorData and ShapeFeatureStateRuntime, rebuilds runtime only on signature changes, merges computed runtime into deck layers, clears cache on reload, and wraps tooltips with element context.
Tests and documentation
packages/core/tests/shapesRenderData.spec.ts, packages/core/tests/tooltipDisplay.spec.ts, packages/layers/tests/shapesLayer.spec.ts, packages/layers/tests/spatialLayerProps.spec.ts, packages/vis/tests/featureTooltipHover.spec.ts, packages/vis/tests/shapeColorEncoding.spec.ts, docs/docs/vis/layer-prop-flow.mdx, AGENTS.md, docs/docs/core/*
Adds/updates tests for positional alignment, tooltip helpers, fill-color encoding, and hover aggregation; updates docs describing shapes feature-state performance, update-trigger guidance, annotation controls, and agent Volta version norms.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

"🐰
Colors stitched on every shape,
Tooltips gather, neat and brave,
Rows aligned, no matching doubt,
Hover sings and panels shout,
Small rabbit hops — the map's anew!"

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.70% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the primary changes: adding shape fill-by-column controls and outline defaults, which aligns with the main objectives and affected files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/add-shape-fill-by-column

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/layers/src/spatialLayerProps.ts (1)

29-48: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add cross-field validation for defaultStrokeWidthMinPixels <= defaultStrokeWidthMaxPixels in packages/layers/src/spatialLayerProps.ts — the schema allows min > max, and packages/layers/src/shapesLayer.ts forwards lineWidthMinPixels/lineWidthMaxPixels to deck.gl without additional checks. Enforce the relationship at the Zod schema boundary with superRefine.

Suggested fix
 export const spatialShapesSublayerSchema = sublayerBase.extend({
   kind: z.literal('shapes'),
   elementKey: z.string(),
   tooltipFields: z.array(z.string()).optional(),
   defaultFillColor: rgbaColorSchema.optional(),
   defaultStrokeColor: rgbaColorSchema.optional(),
   defaultStrokeWidth: z.number().min(0).optional(),
   defaultStrokeWidthUnits: z.enum(['common', 'pixels']).optional(),
   defaultStrokeWidthMinPixels: z.number().min(0).optional(),
   defaultStrokeWidthMaxPixels: z.number().min(0).optional(),
   featureState: z
     .object({
       fillColorByFeatureId: z.record(z.string(), rgbaColorSchema).optional(),
       strokeColorByFeatureId: z.record(z.string(), rgbaColorSchema).optional(),
       hiddenFeatureIds: z.array(z.string()).optional(),
       fadedFeatureIds: z.array(z.string()).optional(),
       filteredOpacityMultiplier: z.number().min(0).max(1).optional(),
     })
     .optional(),
-});
+}).superRefine((value, ctx) => {
+  if (
+    value.defaultStrokeWidthMinPixels !== undefined &&
+    value.defaultStrokeWidthMaxPixels !== undefined &&
+    value.defaultStrokeWidthMinPixels > value.defaultStrokeWidthMaxPixels
+  ) {
+    ctx.addIssue({
+      code: z.ZodIssueCode.custom,
+      message: 'defaultStrokeWidthMinPixels must be <= defaultStrokeWidthMaxPixels',
+      path: ['defaultStrokeWidthMinPixels'],
+    });
+  }
+});
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/layers/src/spatialLayerProps.ts` around lines 29 - 48, The
spatialShapesSublayerSchema currently allows defaultStrokeWidthMinPixels >
defaultStrokeWidthMaxPixels; update spatialShapesSublayerSchema to call
.superRefine(...) and, inside the refine callback, if both
defaultStrokeWidthMinPixels and defaultStrokeWidthMaxPixels are defined and min
> max, add a ZodIssue (pathing to ['defaultStrokeWidthMinPixels'] and/or
['defaultStrokeWidthMaxPixels']) with a helpful message enforcing
"defaultStrokeWidthMinPixels must be <= defaultStrokeWidthMaxPixels" so invalid
configs are rejected at schema validation time.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@AGENTS.md`:
- Around line 19-22: The example path in the guidance that shows using
Volta-managed pnpm is machine-specific ("/Users/ptodd/.volta/bin/pnpm"); update
the sentence that follows "Use the Node.js and pnpm versions pinned in
`package.json` under `volta`" to use a portable example such as
"~/.volta/bin/pnpm" or the dynamic form "$(volta which pnpm)" instead of the
hardcoded user path so the recommendation applies across environments.

In `@packages/vis/src/SpatialCanvas/featureTooltipHover.ts`:
- Around line 28-34: The deck property in ResolveHoverFeatureTooltipOptions and
the corresponding parameter on collectPicks should be narrowed to an interface
exposing only the pickMultipleObjects method instead of the full Deck type;
change ResolveHoverFeatureTooltipOptions.deck to type { pickMultipleObjects:
(opts: {x: number; y: number; radius?: number; layerIds?: any[]; depth?:
number;}) => any } | null (or a suitably named PickMultipleInterface) and update
collectPicks's deck parameter to accept that same interface so tests/mocks can
implement pickMultipleObjects without casting to Deck; keep nullable semantics
and preserve pickRadius/pickDepth usage.

In `@packages/vis/src/SpatialCanvas/ShapeFillColorPanel.tsx`:
- Around line 39-58: The "Fill colour" text is not programmatically associated
with the <select>, hurting accessibility; update the JSX in ShapeFillColorPanel
so the select is labeled: either wrap the select in a <label> or add an id to
the <select> and a corresponding htmlFor on a <label> that contains the visible
text (keep existing styles like helperTextStyle/selectStyle and the same
value/onChange behavior using selected, availableFields and onChange). Ensure
the label text matches the displayed "Fill colour" and that the new id is unique
within this component.

In `@packages/vis/src/SpatialCanvas/useLayerData.ts`:
- Around line 334-336: The cache key generation for the color maps uses string
interpolation `${fillColors}` and `${strokeColors}`, which yields "[object
Object]" and causes signature collisions when mapping contents change; update
the key construction in useLayerData (the array that currently includes
`fillColors ? \`\\x02${Object.keys(fillColors).length}:${fillColors}\` : ''` and
the similar `strokeColors` entry) to serialize the actual mapping contents (for
example by using a stable serializer like JSON.stringify on a sorted list of
entries or joining Object.entries after sorting) so the key reflects both count
and content rather than the object’s default string form.

---

Outside diff comments:
In `@packages/layers/src/spatialLayerProps.ts`:
- Around line 29-48: The spatialShapesSublayerSchema currently allows
defaultStrokeWidthMinPixels > defaultStrokeWidthMaxPixels; update
spatialShapesSublayerSchema to call .superRefine(...) and, inside the refine
callback, if both defaultStrokeWidthMinPixels and defaultStrokeWidthMaxPixels
are defined and min > max, add a ZodIssue (pathing to
['defaultStrokeWidthMinPixels'] and/or ['defaultStrokeWidthMaxPixels']) with a
helpful message enforcing "defaultStrokeWidthMinPixels must be <=
defaultStrokeWidthMaxPixels" so invalid configs are rejected at schema
validation time.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 126e3219-7af8-43dd-a16b-14d2befa7256

📥 Commits

Reviewing files that changed from the base of the PR and between 6c9d243 and e420180.

📒 Files selected for processing (26)
  • AGENTS.md
  • docs/docs/vis/layer-prop-flow.mdx
  • packages/core/src/tableAssociations.ts
  • packages/core/src/tooltip.ts
  • packages/core/tests/shapesRenderData.spec.ts
  • packages/core/tests/tooltipDisplay.spec.ts
  • packages/layers/src/index.ts
  • packages/layers/src/shapesLayer.ts
  • packages/layers/src/spatialLayerProps.ts
  • packages/layers/tests/shapesLayer.spec.ts
  • packages/layers/tests/spatialLayerProps.spec.ts
  • packages/vis/src/SpatialCanvas/ShapeFillColorPanel.tsx
  • packages/vis/src/SpatialCanvas/SpatialCanvasViewer.tsx
  • packages/vis/src/SpatialCanvas/SpatialFeatureTooltip.tsx
  • packages/vis/src/SpatialCanvas/SpatialViewer.tsx
  • packages/vis/src/SpatialCanvas/VivSpatialViewer.tsx
  • packages/vis/src/SpatialCanvas/featureTooltipHover.ts
  • packages/vis/src/SpatialCanvas/index.tsx
  • packages/vis/src/SpatialCanvas/public.ts
  • packages/vis/src/SpatialCanvas/renderers/shapesRenderer.ts
  • packages/vis/src/SpatialCanvas/shapeColorEncoding.ts
  • packages/vis/src/SpatialCanvas/types.ts
  • packages/vis/src/SpatialCanvas/useLayerData.ts
  • packages/vis/src/index.ts
  • packages/vis/tests/featureTooltipHover.spec.ts
  • packages/vis/tests/shapeColorEncoding.spec.ts

Comment thread AGENTS.md
Comment thread packages/vis/src/SpatialCanvas/featureTooltipHover.ts
Comment thread packages/vis/src/SpatialCanvas/ShapeFillColorPanel.tsx Outdated
Comment thread packages/vis/src/SpatialCanvas/useLayerData.ts Outdated
@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown
Contributor

Actionable comments posted: 0

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/vis/src/SpatialCanvas/featureTooltipHover.ts (1)

37-42: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Fix hover tooltip aggregation: pickLayerIds must use deck.gl concrete rendered layer.id strings

ResolveHoverFeatureTooltipOptions.pickLayerIds is documented as “Candidate logical deck layer ids”, but collectPicks forwards them directly to deck.pickMultipleObjects({ layerIds }). In deck.gl, layerIds matches only the exact rendered layer.id values (for composite layers, the concrete sublayer ids), so any “logical”/suffixed ids that are normalized only after picking won’t match and aggregated hover tooltips silently miss those sections. Either plumb the exact rendered deck ids into layerIds before the pick call, or remove/replace the layerIds filter until a correct logical→rendered mapping exists (applies to 57-78 too).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/vis/src/SpatialCanvas/featureTooltipHover.ts` around lines 37 - 42,
The pickLayerIds option in ResolveHoverFeatureTooltipOptions is passing logical
layer ids straight into collectPicks / deck.pickMultipleObjects, but deck.gl
expects concrete rendered layer.id strings (including sublayer suffixes); update
the code that calls collectPicks (or resolveHoverFeatureTooltip) to map the
provided pickLayerIds from logical ids to the actual rendered deck layer ids
before forwarding them to deck.pickMultipleObjects (or else remove the layerIds
filtering temporarily). Locate uses of
ResolveHoverFeatureTooltipOptions.pickLayerIds, the collectPicks helper, and the
deck.pickMultipleObjects call and ensure you either translate logical → rendered
ids (by querying deck.getLayers() / inspecting layer.id on rendered layers) or
stop passing layerIds through until a proper mapping function exists.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@packages/vis/src/SpatialCanvas/featureTooltipHover.ts`:
- Around line 37-42: The pickLayerIds option in
ResolveHoverFeatureTooltipOptions is passing logical layer ids straight into
collectPicks / deck.pickMultipleObjects, but deck.gl expects concrete rendered
layer.id strings (including sublayer suffixes); update the code that calls
collectPicks (or resolveHoverFeatureTooltip) to map the provided pickLayerIds
from logical ids to the actual rendered deck layer ids before forwarding them to
deck.pickMultipleObjects (or else remove the layerIds filtering temporarily).
Locate uses of ResolveHoverFeatureTooltipOptions.pickLayerIds, the collectPicks
helper, and the deck.pickMultipleObjects call and ensure you either translate
logical → rendered ids (by querying deck.getLayers() / inspecting layer.id on
rendered layers) or stop passing layerIds through until a proper mapping
function exists.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e9b86ba8-ae91-4be5-b150-8eef8d38e846

📥 Commits

Reviewing files that changed from the base of the PR and between 929b138 and be0b281.

📒 Files selected for processing (5)
  • packages/vis/src/SpatialCanvas/SpatialCanvasViewer.tsx
  • packages/vis/src/SpatialCanvas/SpatialViewer.tsx
  • packages/vis/src/SpatialCanvas/featureTooltipHover.ts
  • packages/vis/src/SpatialCanvas/index.tsx
  • packages/vis/tests/featureTooltipHover.spec.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/vis/src/SpatialCanvas/SpatialViewer.tsx
  • packages/vis/src/SpatialCanvas/index.tsx

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
packages/vis/src/SpatialCanvas/shapeColorEncoding.ts (1)

97-101: 💤 Low value

Open design questions left inline — worth tracking, not blocking.

You've flagged three valid concerns in-comment: feature-id↔row association should be a single consistent mechanism, this is a per-feature hot path, and the resolution arguably belongs in a shared layer helper rather than vis/SpatialCanvas. The current implementation is correct, but these comments will rot if left untracked. Consider extracting resolveShapeFillColorRowIndex into @spatialdata/layers (shared by labels/shapes) once the association contract is settled, and replacing the musing with a tracked reference.

Want me to open an issue capturing the row-association consolidation and hot-path concern?

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/vis/src/SpatialCanvas/shapeColorEncoding.ts` around lines 97 - 101,
The inline TODOs about feature-id↔row association, hot-path performance, and
placement in vis/SpatialCanvas should be converted into tracked work and the
shared logic extracted: move resolveShapeFillColorRowIndex out of
vis/SpatialCanvas into a shared helper in `@spatialdata/layers` (so labels and
shapes reuse a single association contract), replace the informal comments in
shapeColorEncoding.ts with a single TODO that references the new issue/PR, and
ensure resolveShapeFillColorRowIndex’s API is optimized for the hot path
(minimal allocations and clear input types) before importing it back into
SpatialCanvas.
packages/vis/src/SpatialCanvas/featureTooltipHover.ts (1)

77-90: 💤 Low value

Accessing internal deck.gl API — consider adding a maintenance note.

Lines 80-87 reach into deck.layerManager.getLayers() which is not part of deck.gl's public API surface. The defensive Reflect.get approach avoids crashes if the structure changes, but a future deck.gl update could silently break layer resolution.

Consider adding a brief comment documenting why this internal access is needed and which deck.gl version it was verified against, so future maintainers know to re-verify after upgrades.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/vis/src/SpatialCanvas/featureTooltipHover.ts` around lines 77 - 90,
collectCurrentDeckLayerIds currently reaches into deck.gl internals via
Reflect.get on deck -> layerManager -> getLayers to resolve nested layers; add a
concise maintenance comment above this logic explaining that internal API access
is intentional, which deck.gl major/minor version this was validated against,
the reason (e.g., to access flattened layers not exposed publicly), and a TODO
to re-verify when upgrading deck.gl; reference the function name
collectCurrentDeckLayerIds and the local symbols layerManager and getLayers so
future maintainers can easily find and reassess this hack when updating
dependencies.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/vis/src/SpatialCanvas/featureTooltipHover.ts`:
- Around line 77-90: collectCurrentDeckLayerIds currently reaches into deck.gl
internals via Reflect.get on deck -> layerManager -> getLayers to resolve nested
layers; add a concise maintenance comment above this logic explaining that
internal API access is intentional, which deck.gl major/minor version this was
validated against, the reason (e.g., to access flattened layers not exposed
publicly), and a TODO to re-verify when upgrading deck.gl; reference the
function name collectCurrentDeckLayerIds and the local symbols layerManager and
getLayers so future maintainers can easily find and reassess this hack when
updating dependencies.

In `@packages/vis/src/SpatialCanvas/shapeColorEncoding.ts`:
- Around line 97-101: The inline TODOs about feature-id↔row association,
hot-path performance, and placement in vis/SpatialCanvas should be converted
into tracked work and the shared logic extracted: move
resolveShapeFillColorRowIndex out of vis/SpatialCanvas into a shared helper in
`@spatialdata/layers` (so labels and shapes reuse a single association contract),
replace the informal comments in shapeColorEncoding.ts with a single TODO that
references the new issue/PR, and ensure resolveShapeFillColorRowIndex’s API is
optimized for the hot path (minimal allocations and clear input types) before
importing it back into SpatialCanvas.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a22a18a4-6e53-4477-9732-5df0291dc5d4

📥 Commits

Reviewing files that changed from the base of the PR and between be0b281 and 063d8e2.

📒 Files selected for processing (4)
  • packages/vis/src/SpatialCanvas/featureTooltipHover.ts
  • packages/vis/src/SpatialCanvas/shapeColorEncoding.ts
  • packages/vis/tests/featureTooltipHover.spec.ts
  • packages/vis/tests/shapeColorEncoding.spec.ts

@xinaesthete
xinaesthete merged commit 000bb0b into main Jun 2, 2026
2 checks passed
@xinaesthete
xinaesthete deleted the codex/add-shape-fill-by-column branch June 2, 2026 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant