Skip to content
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

Fix #2351 & cleanup AddToCollectionList component #2353

Merged
merged 7 commits into from
Jan 10, 2024

Conversation

lindapaiste
Copy link
Collaborator

@lindapaiste lindapaiste commented Aug 5, 2023

Fixes #2363
Fixes #2351
Progress on #2179

Changes:

  • Convert AddToCollectionList to a function component.
  • The only prop needed is projectId -- the id of the project to add to the chosen collection.
  • Access Redux state via useSelector and useDispatch.
  • Return a Promise from the getCollections action so that the component knows when loading is complete.
  • Delete the getProject fetch as the project details are not used.
  • Delete the if condition on the title as a user is always adding to their own collections, even when it's another user's project.
    • AddToCollectionList.AnothersTitle can be removed from translation files, but I didn't do this.
  • Delete so many PropTypes.
  • Delete imports for unused action creators (see mapStateToProps and mapDispatchToProps often include unused props #2179). Only /actions/collections is used. The other four are not needed.
  • Removed over 100 lines!

I have verified that this pull request:

  • has no linting errors (npm run lint)
  • has no test errors (npm run test)
  • is from a uniquely-named feature branch and is up to date with the develop branch.
  • is descriptively named and links to an issue number, i.e. Fixes #123

…llectionList

# Conflicts:
#	client/modules/IDE/components/AddToCollectionList.jsx
@lindapaiste lindapaiste mentioned this pull request Sep 13, 2023
4 tasks
@raclim raclim added this to the Next Release milestone Oct 19, 2023
Copy link
Contributor

@PiyushChandra17 PiyushChandra17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely Done

Copy link
Collaborator

@raclim raclim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this!

I fixed some merge conflicts and also updated the props passed in IDEOverlays to reflect the new changes. Besides that, I don't think there should be any other major additional changes, but let me know if you spot anything!

@raclim raclim merged commit 0aadc8c into processing:develop Jan 10, 2024
@lindapaiste
Copy link
Collaborator Author

lindapaiste commented Jan 10, 2024

Thanks for working on this!

I fixed some merge conflicts and also updated the props passed in IDEOverlays to reflect the new changes. Besides that, I don't think there should be any other major additional changes, but let me know if you spot anything!

@raclim there is definitely in a problem in the IDEOverlays. There is no this.state so projectId={this.state.sketchToAddToCollection.id} won't work. It looks like we want to keep the projectId={params.project_id} there and the only change to that file is to remove the line username={params.username}.

@raclim
Copy link
Collaborator

raclim commented Jan 10, 2024

Thanks for catching that! I'll create a new issue now to quickly update it.

@raclim raclim mentioned this pull request Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

"Add To Collection" doesn't work when viewing another user's sketch list PropTypes errors on CollectionList
3 participants