Skip to content

check unicity when selected directory change#1044

Open
souissimai wants to merge 3 commits intomainfrom
fix-unicity-name-change-selected-directory
Open

check unicity when selected directory change#1044
souissimai wants to merge 3 commits intomainfrom
fix-unicity-name-change-selected-directory

Conversation

@souissimai
Copy link
Contributor

PR Summary

SOUISSI Maissa (Externe) and others added 3 commits March 9, 2026 09:18
Signed-off-by: SOUISSI Maissa (Externe) <souissimai@gm0winl878.bureau.si.interne>
fix
Signed-off-by: SOUISSI Maissa (Externe) <souissimai@gm0winl878.bureau.si.interne>
@sonarqubecloud
Copy link

Copy link
Contributor

@Mathieu-Deharbe Mathieu-Deharbe left a comment

Choose a reason for hiding this comment

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

It corrects the bug but I don't really get it.

Just above we do :
const directory = selectedDirectory || activeDirectory;

And then when checking the name :
elementExists(activeDirectory ?? selectedDirectory

Ok it doesn't have the right value when calling handleCheckName but what is the point of directory if it is not used to check the name in the directory ?

I think it would be clearer if we simply send the directory that we wish to check to handleCheckName as a parameter.

Comment on lines 60 to +61
if (nameValue !== currentName && directory) {
elementExists(directory, nameValue, elementType)
elementExists(activeDirectory ?? selectedDirectory, nameValue, elementType)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we check for directory if this is ot used in the following code anymore ? Shouldn't we check for selectedDirectory ?

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