Open
Conversation
- Fix !dataSource === undefined (always false) → dataSource === undefined - Remove dead applyViewStateConstraints() from MapStory (never called) - Remove duplicate selectedCounty from FilterState (shadowed by map.selectedCounty) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Reviewer's guide (collapsed on small PRs)Reviewer's GuideCleans up unused state and fixes a worker guard condition by correcting an operator precedence bug, removing dead React view-state code, and deleting an unused county-selection field and reducer from the filters slice. Sequence diagram for worker message validation in dataProcessor.workersequenceDiagram
participant MainThread
participant DataProcessorWorker
MainThread->>DataProcessorWorker: postMessage(geojsonFeatures, filteredData, selectedMetric, dataSource, isPerCapita, populationData)
DataProcessorWorker->>DataProcessorWorker: onmessage(event)
DataProcessorWorker->>DataProcessorWorker: extract geojsonFeatures, filteredData, selectedMetric, dataSource, isPerCapita, populationData
alt Missing_or_invalid_data
DataProcessorWorker->>DataProcessorWorker: if !geojsonFeatures || !filteredData || !selectedMetric || dataSource === undefined
DataProcessorWorker->>DataProcessorWorker: log error Invalid data received
DataProcessorWorker-->>MainThread: postMessage({ error })
else Valid_data
DataProcessorWorker->>DataProcessorWorker: process data with selectedMetric, dataSource, isPerCapita, populationData
DataProcessorWorker-->>MainThread: postMessage({ choroplethData, summaryStats })
end
Class diagram for updated FilterState and filterSlice reducersclassDiagram
class FilterState {
+string[] activeFilters
+number[] yearRange
+string selectedMetric
+RankedCounty[] rankedCounties
+DataSourceType selectedDataSource
+boolean isPerCapita
+string[] selectedCounties
+CsvRow[][] csvDataSources
}
class RankedCounty {
+string name
+number value
+number rank
}
class CsvRow {
+string county
+number value
+number population
+number year
}
class FilterSliceReducers {
+setRankedCounties(state, rankedCounties)
+setCsvData(state, csvRows)
+toggleFilter(state, filterId)
+setYear(state, year)
+setYearRange(state, startYear, endYear)
+setSelectedMetric(state, metricId)
+setSelectedDataSource(state, dataSource)
+setIsPerCapita(state, isPerCapita)
+setSelectedCounties(state, selectedCounties)
+resetOnDataSourceChange(state, newDataSource)
}
FilterSliceReducers o-- FilterState
FilterState "*" o-- "*" CsvRow
FilterState "*" o-- "*" RankedCounty
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In
dataProcessor.worker.ts, consider simplifying the long guard condition by extracting it into a smallisValidMessagePayloadhelper or by checking each required field with more explicit nullish checks (e.g.dataSource == null) to improve readability and make future changes safer. - Since
applyViewStateConstraintswas removed fromMapStory.tsx, double-check that equivalent clamping of longitude/latitude/zoom is now handled elsewhere; if so, a short inline comment near the new logic explaining where constraints are enforced would prevent future reintroduction of similar dead code.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `dataProcessor.worker.ts`, consider simplifying the long guard condition by extracting it into a small `isValidMessagePayload` helper or by checking each required field with more explicit nullish checks (e.g. `dataSource == null`) to improve readability and make future changes safer.
- Since `applyViewStateConstraints` was removed from `MapStory.tsx`, double-check that equivalent clamping of longitude/latitude/zoom is now handled elsewhere; if so, a short inline comment near the new logic explaining where constraints are enforced would prevent future reintroduction of similar dead code.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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
!dataSource === undefined(alwaysfalse) →dataSource === undefinedindataProcessor.worker.tsapplyViewStateConstraints()function fromMapStory.tsx(defined but never called)selectedCounty: stringfromFilterStateinfilterSlice.ts— shadowed bymap.selectedCounty, not consumed by any component; also removes unreachablesetSelectedCountyreducer from the filters sliceTest plan
npm run buildpasses with no TypeScript errors/map— map renders counties with colors🤖 Generated with Claude Code
Summary by Sourcery
Clean up unused code and correct a worker input validation condition.
Bug Fixes:
Enhancements: