Skip to content

Fix short description change request 1452#1459

Open
emariam22 wants to merge 2 commits into
ShelterTechSF:masterfrom
emariam22:fix-short-description-change-request-1452
Open

Fix short description change request 1452#1459
emariam22 wants to merge 2 commits into
ShelterTechSF:masterfrom
emariam22:fix-short-description-change-request-1452

Conversation

@emariam22
Copy link
Copy Markdown

Summary

Fixes an issue where the frontend sends a change request even when the user clicks save without making any edits.

Root Cause

The edit page compares values in component state with values returned from the API to determine if a resource was modified. However, many fields in state can be undefined while the API returns actual values (strings or null). This caused comparisons like undefined !== "value" to always evaluate as true, incorrectly marking the resource as modified.

Additionally, short_description was being compared even though it is not editable on this page, which also contributed to false positives.

Fix

  • Removed the short_description comparison
  • Updated all resource field comparisons to ignore undefined values:
    • Only compare when the state value is defined AND different from the API value

Testing

Tested using resource id 2:

  • Clicking Save without changes:

    • No change_requests request sent
  • Modifying a field:

    • change_requests request is sent correctly

This confirms the fix prevents false-positive change requests while preserving correct behavior.

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.

1 participant