Skip to content

More reviewed null checks from LLM - #1624

Merged
matkoniecz merged 16 commits into
colouring-cities:masterfrom
matkoniecz:fix/reviewed-null-checks
Oct 23, 2026
Merged

matkoniecz merged 16 commits into
colouring-cities:masterfrom
matkoniecz:fix/reviewed-null-checks

Conversation

@matkoniecz

Copy link
Copy Markdown
Contributor

No description provided.

matkoniecz and others added 16 commits October 20, 2026 09:49
processCurrentLandUseClassifications and
processOriginalLandUseClassifications were declared as returning
Promise<any>, which is overly broad: both return the attributes
update with the derived land use group and order fields merged in.

Declare them as returning Promise<Partial<BuildingAttributes>>, the
same type as the update they receive, so that callers keep a checked
type instead of any.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It returns undefined when the token is not valid, which the caller
already checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DataContainer renders it unconditionally, including in the category
panel shown before any building is selected (e.g. /view/age). It
already skips fetching history when no building is selected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The map colour scale and its setter are owned by MapApp and only passed
through DataContainer, which hands them to the wrapped category view
from this.props. The copy kept in state was never read.

It was also refreshed only when the selected building changed, so
after switching map style on the same building it held a stale value.
Keeping a single source in props avoids that.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It already highlights a building only when one is selected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There is no username when logged out, and the menu then shows the
login links instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Without a data query parameter there is no data and no error, and
sending the update failed on the missing edits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
All of them may be left out, and the service handles that.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It calls hasOwnProperty on its argument, which fails for null and
undefined.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Parsing an unset port gave NaN, which pg and nodemailer treat as not
given and fall back to their default port; leaving it undefined does
the same explicitly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The page already shows a loading message until they arrive, and the
latest extract is missing when there are none.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It is passed to the input as is, and is built from optional flags.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The slider marks are built from it, and all sliders give one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A doubled comma left a hole in the list, shown as an empty option.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI 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.

🟢 Approval recommended

Static review found no blocking regressions in these focused type and null-handling changes; tests and builds were not run.

No open issues 🎉

What changed in this PR

This PR improves null handling and TypeScript type accuracy across frontend components, API services, and connection configuration.

Changes:

  • Align types with optional values and tighten helper, slider, and service contracts.
  • Guard multi-edit updates and port parsing when values are undefined.
  • Remove redundant component state and an unintended empty array entry.
File Description
app/​src/​helpers.ts Constrain the property-check helper’s object type.
app/​src/​frontend/​pages/​data-extracts.tsx Allow undefined extract state.
app/​src/​frontend/​map/​map.tsx Make the selected building ID optional.
app/​src/​frontend/​map-app.tsx Require multi-edit data before sending updates.
app/​src/​frontend/​header.tsx Allow an undefined username.
app/​src/​frontend/​config/​data-fields-config.ts Remove an empty date-range array entry.
app/​src/​frontend/​components/​tooltip.tsx Explicitly type the interwoven array.
app/​src/​frontend/​building/​edit-history/​edit-history.tsx Allow undefined history while loading.
app/​src/​frontend/​building/​edit-history/​edit-history-latest.tsx Model optional data and pass the checked building into the fetch function.
app/​src/​frontend/​building/​data-container.tsx Remove redundant map colour scale state.
app/​src/​frontend/​building/​data-components/​slider-data-entry.tsx Require minimum and maximum bounds.
app/​src/​frontend/​building/​data-components/​logical-data-entry/​logical-data-entry.tsx Make the disabled flag optional.
app/​src/​db.ts Skip parsing an undefined database port.
app/​src/​api/​services/​passwordReset.ts Reflect an undefined token-verification result.
app/​src/​api/​services/​email.ts Skip parsing an undefined mail server port.
app/​src/​api/​services/​domainLogic/​processBuildingUpdate.ts Specify partial building-attribute return types.
app/​src/​api/​controllers/​editHistoryController.ts Reflect optional query parameter values.

Review effort: Balanced

@matkoniecz
matkoniecz merged commit 8a360bd into colouring-cities:master Oct 23, 2026
5 checks passed
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.

2 participants