fix(settings): order parseSettings before initBuckets; dedupe color defaults#246
Merged
Demonkratiy merged 1 commit intoJun 15, 2026
Merged
Conversation
…match rendered mode - dedupe stroke/textColor defaults into GeneralSettings constants - add high-contrast regression test guarding the init order
There was a problem hiding this comment.
Pull request overview
This PR is a focused follow-up to the gradient-middle work (#221) that fixes a settings initialization ordering issue affecting high-contrast rendering, and centralizes a couple of default color constants to avoid drift.
Changes:
- Reorders
update()to runparseSettings()beforeinitBuckets()so bucket min/max constraints are computed from the final (post-parse) mode, particularly in high-contrast mode. - Deduplicates default
strokeandtextColorvalues intoGeneralSettings.DefaultStroke/GeneralSettings.DefaultTextColorand reuses them in both settings initialization andparseSettings(). - Adds a high-contrast regression test that drives the full
update()flow and asserts bucket constraint min/max values match the non-colorbrewer limits.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| test/visualTest.ts | Adds a high-contrast regression test validating post-parse bucket min/max constraints. |
| src/visual.ts | Reorders settings initialization so parseSettings() runs before initBuckets(). |
| src/settings.ts | Introduces shared constants for default stroke/text colors and uses them in GeneralSettings. |
| src/heatmapUtils.ts | Uses GeneralSettings default color constants in parseSettings() to avoid duplicated literals. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
kullJul
approved these changes
Jun 15, 2026
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.
Summary
Small follow-up cleanups after #221 (gradient middle feature).
Changes
parseSettings()beforeinitBuckets()inupdate().parseSettings()can flipenableColorbrewer/activateGradientMiddle(e.g. in high-contrast mode), so running it first ensures bucket constraints (buckets.options.min/maxValue,CurrentBucketCount) match the final rendered mode instead of being stuck at the pre-parse Colorbrewer limits.stroke/textColordefaults intoGeneralSettings.DefaultStroke/GeneralSettings.DefaultTextColorconstants, referenced from bothGeneralSettingsandparseSettings()to avoid future drift.update()flow and asserts the post-parse bucket constraints (minValue = 1,maxValue = 18). This test fails on the oldinitBuckets → parseSettingsorder and passes on the new one, guarding the fix against future reordering.Notes
persistProperties) will be a separate PR.Validation
eslint src/clean71/71unit tests pass