Skip to content

Refactor buildNewPersonalTableSettingsEntity function to handle undefined values instead of null#1509

Merged
Artuomka merged 1 commit into
mainfrom
backend_table_setting_ordering_cleaning
Jan 20, 2026
Merged

Refactor buildNewPersonalTableSettingsEntity function to handle undefined values instead of null#1509
Artuomka merged 1 commit into
mainfrom
backend_table_setting_ordering_cleaning

Conversation

@Artuomka

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings January 20, 2026 09:12
@Artuomka Artuomka enabled auto-merge January 20, 2026 09:12

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.

Pull request overview

This pull request attempts to refactor the buildNewPersonalTableSettingsEntity function by changing it to check for undefined values instead of null values, and updates the indentation from spaces to tabs for consistency with the rest of the codebase.

Changes:

  • Modified the condition to check for undefined instead of null when deleting properties from the entity
  • Converted indentation from spaces to tabs throughout the function

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

const newEntity = new PersonalTableSettingsEntity();
Object.assign(newEntity, personalSettingsData);
Object.keys(personalSettingsData).forEach((key) => {
if (personalSettingsData[key as keyof PersonalTableSettingsData] === undefined) {

Copilot AI Jan 20, 2026

Copy link

Choose a reason for hiding this comment

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

The change from checking null to undefined creates a bug. The PersonalTableSettingsData type defines all fields as type | null, and the controller explicitly converts undefined values to null using || null (see lines 116-121 in personal-table-settings.controller.ts). This means the function will never receive undefined values - it will only receive null values. As a result, properties with null values will no longer be deleted from the entity as intended, breaking the existing functionality.

Suggested change
if (personalSettingsData[key as keyof PersonalTableSettingsData] === undefined) {
if (personalSettingsData[key as keyof PersonalTableSettingsData] === null) {

Copilot uses AI. Check for mistakes.
@Artuomka Artuomka disabled auto-merge January 20, 2026 12:53
@Artuomka Artuomka merged commit 9dc8d84 into main Jan 20, 2026
22 of 28 checks passed
@Artuomka Artuomka deleted the backend_table_setting_ordering_cleaning branch January 20, 2026 12:53
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