Repository navigation
refactor: Replace isDefined spreads with an omitUndefined helper - #1292
Merged
Merged
Conversation
Replace the long runs of `...(isDefined(x) && { x })` spreads with a
single `...omitUndefined({ ... })` per group. deck.gl copies an explicit
`undefined` over a layer's default props, so unset props must be left
out rather than passed as `undefined`; the helper does that in one place.
Spreads that transform the value (e.g. `accessColorData(...)`) keep the
explicit `isDefined` check. Behavior is unchanged: the helper drops the
same `null` and `undefined` values that `isDefined` did.
Closes #1196
Co-Authored-By: Claude Opus 5.5 <[email protected]>
kylebarron
commented
Sep 30, 2026
kylebarron
commented
Sep 30, 2026
…ned` `accessColorData` and `accessFloatData` now return `undefined` for an unset accessor, and vector accessors use `?.`, so the accessor props can go through `omitUndefined` like every other optional prop. The same goes for the flyTo options in the overlay renderer, which used `!= null` spreads. With no conditional spreads left, `isDefined` has no callers and is removed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
omitUndefined helperisDefined spreads with an omitUndefined helper
kylebarron
enabled auto-merge (squash)
September 30, 2026 00:15
kylebarron
added a commit
that referenced
this pull request
Sep 30, 2026
> [!NOTE] > This PR was written by Claude (Claude Code), not by @kylebarron. Fixes the failing `Python test` workflow on `main`. The `normalize-notebook-kernelspec` pre-commit hook added in #1254 requires every notebook's kernelspec to be exactly `{"display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3"}`. `examples/geohash-layer.ipynb` (added in #1242) has `"display_name": "Python 3"`, so the hook rewrites it and fails the `tests (3.11)` job, which is the job that runs pre-commit. #1254's PR CI passed because its base branch was older than #1242, so the geohash notebook wasn't there to check. The two changes only met after both merged. This PR is the output of running the hook itself: a one-line change to `display_name`. It's the only notebook in the repo that didn't already match. `uv run pre-commit run --all-files` passes locally with this change. The earlier failure on the #1292 push was a separate, transient network error (`uv sync` couldn't download the `pyogrio` wheel from PyPI) and needs no change. 🤖 Written by [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
This PR was written by Claude (Claude Code), not by @kylebarron.
Closes #1196
Before, the frontend passed each optional prop to deck.gl with its own conditional spread:
This PR adds an
omitUndefinedhelper tosrc/util.ts, like the one in developmentseed/deck.gl-raster#557. Each layer, view or control now passes its optional props through a single call:Props have to be left out, not passed as
undefined, because deck.gl copies an explicitundefinedover a layer's default. The helper now handles that in one place.What changed
omitUndefineddrops bothnullandundefined, matching the oldisDefinedcheck. Unset traits arrive from Python asnull, so behavior doesn't change.accessColorDataandaccessFloatDatareturnundefinedfor an unset accessor. Vector accessors use?.data[batchIndex]. This lets accessor props go throughomitUndefinedtoo.flyTooptions inrenderers/overlay.tsxused!= nullspreads and now use the helper as well.extensionProps,prepareTextureand theDataFilterExtensionwere the last callers ofisDefined. They are rewritten, andisDefinedis removed.omitUndefinedand for the accessor helpers with unset input.The
Number.isFinitespreads insanitizeViewStatestay as they are, because they also dropNaNandInfinity.Checks
pnpm testpasses.biome checkis clean.pnpm buildsucceeds.tsc --noEmitshows the same 7 errors asmainand no new ones.🤖 Written by Claude Code