-
Notifications
You must be signed in to change notification settings - Fork 11
Remove unused project and image code #1293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
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
|
From @loiswells97 - #1171 depends on this, so we would need to bring this back in some form if we wanted to work on #1171 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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.