-
Notifications
You must be signed in to change notification settings - Fork 178
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(app): avoid the name conflict issue in the same network #10723
fix(app): avoid the name conflict issue in the same network #10723
Conversation
…twork this PR will avoid the same name robot issue in the same network. if there is the same name in the same network, the app shows error message.
Codecov Report
@@ Coverage Diff @@
## release_6.0.0 #10723 +/- ##
==============================================
Coverage 73.84% 73.84%
==============================================
Files 2158 2158
Lines 58341 58361 +20
Branches 5961 5966 +5
==============================================
+ Hits 43079 43094 +15
- Misses 13989 13994 +5
Partials 1273 1273
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@@ -64,6 +70,11 @@ export function RenameRobotSlideout({ | |||
if (!regexPattern.test(newName)) { | |||
errors.newRobotName = t('rename_robot_input_limitation_detail') | |||
} | |||
if ( | |||
healthyReachableRobots.find(robot => newName === robot.name) != null |
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.
small suggestion, the some
method here would avoid the need for the null
/undefined
check as it returns true
or false
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.
yeah, you are right. Thank you, @vabruzzo!
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.
lgtm 👍
const healthyReachableRobots = useSelector((state: State) => | ||
getConnectableRobots(state) | ||
) |
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.
Why is this limited to connectable robots? If a robot is merely "reachable" (but not "connectable"), it may still be on the network advertising over mDNS and therefore a potential source of name conflict.
I also think there's a strong argument to include all robots, not just the currently connectable or reachable one. If you rename a robot to the same name as an unreachable one, the app will think: "hey, this unreachable robot just became reachable", which is not what happened. And, if that unreachable robot comes back online after you've renamed another robot, it will have a new naming conflict and rename itself to avoid that conflict.
I personally think it's reasonable to force the user to "Forget unreachable robot" before allowing them to re-use a name
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.
Mike thank you for your feedback!
Merge branch 'edge' into app_fix-temporary-solution-for-the-same-name
Regarding the error message, I think we should be a little more specific than "Robot name already exists". Maybe something like "Another robot on your network already has this name". As for the feature itself, what happens if I name robot 1 "BitterWood", turn it off, turn on robot 2, name it "BitterWood", and then turn robot 1 back on again? |
Thanks, @ecormany ! (I will post your suggestion to the team channel).
When turning on robot 1, the name of robot1 will be There would be 2 cases (this depends on users' env) [start] [rename] [start] [rename] |
The message for name conflict
useGetRobotName
|
|
Overview
This PR will avoid the same name robot issue in the same network. if there is the same name in the same network, the app shows an error message.
In terms of the error message, this should be temporary. We need to ask about the reasonable message to @emilywools and @ecormany
Also need support from the design team since if we remove unavailable robot, we will need to add a modal to get confirmation from users.
#10709
Changelog
Review requests
Risk assessment
low