CenterForDigitalHumanities / CenterForDigitalHumanities/TPEN-interfaces
Remove dead code: Project.save() and unused helper methods
- Dominant language
- JavaScript
- Stars
- 2
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
## Cleanup
**Type:** Dead code removal
**File:** `api/Project.js`
### Description
`Project.save()` (lines 121-141) and five helper methods that call it are dead code — never invoked anywhere in the codebase. The Interfaces architecture evolved to use granular, resource-specific endpoints instead of a general save.
### Dead Code to Remove
1. **`save()`** (line ~121) — sends `PUT /project/:id` which doesn't even exist on the backend (returns 405)
2. **`setMetadata()`** (line ~261) — calls `this.save()`
3. **`addLayer()`** (line ~278) — calls `this.save()`
4. **`removeLayer()`** (line ~283) — calls `this.save()`
5. **`addTool()`** (line ~288) — calls `this.save()`
6. **`removeTool()`** (line ~293) — calls `this.save()`
None of these methods are called from any component, page, or script in the codebase. All project mutations go through specific endpoints:
- `PATCH /project/:id/label` — used by `project-details`
- `PUT /project/:id/metadata` — used by `update-metadata`
- `POST /project/:id/layer` — used by `manage-layers`
- `POST /project/:id/tool` — used by `project-tools`
- `PUT /project/:id/custom` — used by `navigation-manager`, `quicktype-manager`
### Context
Found during pre-production stack testing (2026-03-26). The backend route `PUT /project/:id` was flagged as a mismatch (CenterForDigitalHumanities/TPEN-services#495), but investigation confirmed the Interfaces code never calls it. Services issue closed as not_planned.
Also remove the `"tpen-project-saved"` and `"tpen-project-save-failed"` event dispatches if no other code listens for them.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.