Open
Conversation
Unused code has a maintenance cost. This has been in the project for a few years.
The previous commit removes the only use of this dependency
I also searched out logs for for editor endpoints to confirm that these aren't used
I think this moved to the standalone project
The only use of this was removed in the previous commit
f8c027f to
4967af9
Compare
Contributor
Author
|
From @loiswells97 - #1171 depends on this, so we would need to bring this back in some form if we wanted to work on #1171 |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes unused project list/image upload API wrappers and associated UI, tests, styles, translations, and dependencies that are no longer used in the editor or have moved to the standalone app.
Changes:
- Removed unused API functions (
getImage,readProjectList,uploadImages) and their tests, plus theloadProjectListthunk andupdateImagesreducer wiring. - Deleted the
ImageUploadButtoncomponent, its tests, styles, and i18n strings in all locales. - Cleaned up now-unused dependencies (
react-dropzone,parse-link-headerand their transitive deps) frompackage.jsonandyarn.lock.
Reviewed changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
yarn.lock |
Pruned lockfile entries for react-dropzone, parse-link-header, and their transitive dependencies to match the dependency removals. |
src/utils/apiCallHandler.test.js |
Updated API handler tests to stop referencing removed image/project list API helpers while keeping coverage for core project and error endpoints. |
src/utils/apiCallHandler.js |
Removed unused API wrappers (getImage, readProjectList, uploadImages) and simplified the exported handler object to only include still-used methods. |
src/redux/EditorSlice.js |
Dropped the unused loadProjectList thunk, parse-link-header import, and updateImages reducer/action export, while keeping other editor state behavior intact. |
src/components/Editor/ImageUploadButton/ImageUploadButton.test.js |
Deleted tests for the now-removed ImageUploadButton component. |
src/components/Editor/ImageUploadButton/ImageUploadButton.jsx |
Removed the ImageUploadButton component and its image-upload modal logic, which is no longer used. |
src/assets/stylesheets/ImageUploadButton.scss |
Deleted styling used exclusively by the removed image upload modal. |
public/translations/xx-XX.json |
Removed unused imageUploadButton translation block. |
public/translations/fr-FR.json |
Removed unused imageUploadButton translation block. |
public/translations/es-LA.json |
Removed unused imageUploadButton translation block. |
public/translations/en.json |
Removed unused imageUploadButton translation block. |
public/translations/en-US.json |
Removed unused imageUploadButton translation block. |
package.json |
Removed react-dropzone and parse-link-header from dependencies to reflect the deleted UI and API-list code. |
Comments suppressed due to low confidence (1)
src/utils/apiCallHandler.js:100
createErroralways includeserror_type,project_id, anduser_idkeys in the POST body, even when those values areundefined, but the corresponding tests (and likely the API contract) expect onlyerrorfor the basic case and to include the optional fields only when they are present. This mismatch will cause the axios mock expectations inapiCallHandler.test.jsto fail and may send unexpected fields to the backend; consider constructing the payload object conditionally so thaterror_type,project_id, anduser_idare only added when their values are defined, or adjust the tests and API expectations consistently.
const createError = async (
projectIdentifier,
userId,
error,
sendError = false,
) => {
if (!sendError) {
return;
}
const { errorMessage, errorType } = error;
return await post(`${host}/api/project_errors`, {
error: errorMessage,
error_type: errorType,
project_id: projectIdentifier,
user_id: userId,
});
};
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related to https://github.com/RaspberryPiFoundation/digital-editor-issues/issues/1075
As part of https://github.com/RaspberryPiFoundation/digital-editor-issues/issues/1075 I was understanding how project loading works and noticed a set of API wrappers and image upload functionality that is not being used.
I think some of this was never used, and some of it has moved to the standalone app.