Skip to content

Conversation

@zetter-rpf
Copy link
Contributor

@zetter-rpf zetter-rpf commented Jan 26, 2026

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.

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
@zetter-rpf zetter-rpf temporarily deployed to previews/1293/merge January 26, 2026 15:40 — with GitHub Actions Inactive
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
@zetter-rpf zetter-rpf force-pushed the remove-unused-project-and-image-code branch from f8c027f to 4967af9 Compare January 26, 2026 15:51
@zetter-rpf zetter-rpf temporarily deployed to previews/1293/merge January 26, 2026 15:51 — with GitHub Actions Inactive
@zetter-rpf
Copy link
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

Copy link
Contributor

Copilot AI left a 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 the loadProjectList thunk and updateImages reducer wiring.
  • Deleted the ImageUploadButton component, its tests, styles, and i18n strings in all locales.
  • Cleaned up now-unused dependencies (react-dropzone, parse-link-header and their transitive deps) from package.json and yarn.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

  • createError always includes error_type, project_id, and user_id keys in the POST body, even when those values are undefined, but the corresponding tests (and likely the API contract) expect only error for the basic case and to include the optional fields only when they are present. This mismatch will cause the axios mock expectations in apiCallHandler.test.js to fail and may send unexpected fields to the backend; consider constructing the payload object conditionally so that error_type, project_id, and user_id are 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.

@adrian-rpf adrian-rpf self-requested a review January 29, 2026 18:02
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.

2 participants