Skip to content

fix: resolve entity editing workflow, and dayjs runtime crashes#19

Open
Bodeayman wants to merge 2 commits intoistSOS:mainfrom
Bodeayman:fix/patch-delete-entities
Open

fix: resolve entity editing workflow, and dayjs runtime crashes#19
Bodeayman wants to merge 2 commits intoistSOS:mainfrom
Bodeayman:fix/patch-delete-entities

Conversation

@Bodeayman
Copy link
Copy Markdown

@Bodeayman Bodeayman commented Mar 27, 2026

PR Description

Closes Issue #18

Overview

This PR addresses several critical UI and integration issues in the SensorThings entity management workflow, specifically focusing on the Edit functionality, dashboard stability, and backend integration.

Key Changes

1. Fixed Entity Editing Workflow

  • Restored Missing Edit State: Re-implemented the editFormState and corresponding operation="edit" modal in Home.tsx that were previously missing or non-functional.
  • Resolved Stale Closures: Fixed a bug in DatastreamTable.tsx where the renderCell callback was capturing outdated references to the onEditDatastream handler. The edit button now reliably triggers the modal.
  • Form Data Normalization: Integrated toDatastreamFormData and other utility helpers to ensure entity data is correctly mapped from the API response to the form fields.

2. Enhanced Dashboard Stability

  • Day.js UTC Support: Initialized dayjs with the utc plugin in Home.tsx. This prevents runtime crashes when processing datastream time ranges (which use dayjs.utc()).
  • Leaflet Marker Robustness: Ensured markers are drawn only when valid geometries are available, preventing silent failures in the map component.

3. Backend Integration (422 Error Fixes)

  • Fallback Commit-Message Headers: Added fallback commit-message headers to API services (locations.ts, sensors.ts, etc.) to comply with the backend's strict requirement for a commit message on all POST/PATCH operations, resolving several 422 Unprocessable Entity errors.

Verification Results

  • Edit Modal: Clicking the edit icon in the datastream table correctly opens the pre-filled form with accurate entity data.
  • Map Stability: The dashboard loads without crashes, and markers render correctly for valid geometries.
  • Backend Integration: Creating or updating entities via the UI no longer triggers 422 errors; commit messages are correctly sent in API requests.

…reference and initialized dayjs with the UTC plugin to prevent crashes when loading the datastream data
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