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

#2267- Using Template Tool, Salts and Solvents should replace Atoms, Functional Groups, and Salts and Solvents & #1994 - Salts and Solvents: Edit notification appears instead of replacing new Salt or Solvent #2391

Conversation

yuleicul
Copy link
Collaborator

@yuleicul yuleicul commented Mar 20, 2023

Closes #2267
Closes #1994
Refactors TemplateTool: extracts code for specific function to method, adds types to member variables.

@yuleicul yuleicul self-assigned this Mar 21, 2023
@yuleicul yuleicul changed the title #2267 Using Template Tool, Salts and Solvents should replace Atoms, Functional Groups, and Salts and Solvents #2267- Using Template Tool, Salts and Solvents should replace Atoms, Functional Groups, and Salts and Solvents & #1994 - Salts and Solvents: Edit notification appears instead of replacing new Salt or Solvent Mar 22, 2023
@yuleicul yuleicul marked this pull request as ready for review March 22, 2023 10:18
if (mergeItems?.atoms.size === 1 && mergeItems.bonds.size === 0) {
// get ID of single dst (target) atom we are hovering over
return { map: 'atoms', id: mergeItems.atoms.values().next().value }
}
return null
return undefined
Copy link
Collaborator

Choose a reason for hiding this comment

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

@yuleicul can you please explain this change

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The return value of getDragCtxItem is assigned to this.dragCtx.item whose type is DragContextItem | undefined.

Before this PR, the type of this.dragCtx.item was like DragContextItem | undefined | null. I wanted to simplify undefined | null as undefined or null. Because we have code like delete this.dragCtx.item, undefined is a better solution.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Btw, I find this function is deleted by #2408. That's what I wanted to do as well 🤣 I guess there will be some conflicts with #2408, but no worries I can resolve them before merging.

@yuleicul
Copy link
Collaborator Author

Since lots of conflicts, see the new PR #2504 without refactoring.

@yuleicul yuleicul closed this Apr 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants