feat: update DotBotsMapPoint to not update when props doesn't change#214
Merged
aabadie merged 4 commits intoDotBots:mainfrom Feb 27, 2026
Merged
Conversation
5080a1f to
7c31ea0
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #214 +/- ##
=======================================
Coverage 68.84% 68.84%
=======================================
Files 40 40
Lines 3739 3739
=======================================
Hits 2574 2574
Misses 1165 1165 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
7c31ea0 to
2a87fdc
Compare
aabadie
reviewed
Feb 26, 2026
Contributor
|
Amazing!! |
Contributor
|
The UI crashes when setting waypoints manually. I had to apply the following diff to make it work again fully: diff --git a/dotbot/frontend/src/DotBotsMap.js b/dotbot/frontend/src/DotBotsMap.js
index aa6697b..e601eb1 100644
--- a/dotbot/frontend/src/DotBotsMap.js
+++ b/dotbot/frontend/src/DotBotsMap.js
@@ -122,6 +122,8 @@ const DotBotsMapPoint = React.memo((props) => {
opacity={waypointOpacity}
waypoints={props.dotbot.waypoints}
threshold={props.dotbot.waypoints_threshold}
+ areaSize={props.areaSize}
+ mapSize={props.mapSize}
/>
))
)}
@@ -203,6 +205,7 @@ export const DotBotsMap = (props) => {
mapSize={props.mapSize}
showHistory={props.showHistory}
updateActive={props.updateActive}
+ mapClicked={mapClicked}
active={props.active}
historySize={props.historySize}
/>) |
Contributor
|
Otherwise I was able to test a locally modified blinky script (see the diff below) with 500 robots. It's not super fluid but it's much better than before! diff --git a/dotbot/examples/blinky.py b/dotbot/examples/blinky.py
index 9cd5eca..858301e 100644
--- a/dotbot/examples/blinky.py
+++ b/dotbot/examples/blinky.py
@@ -53,25 +53,7 @@ async def blinky(
# "blue": int(b * 255),
# },
# )
- waypoints = DotBotWaypoints(
- threshold=THRESHOLD,
- waypoints=[
- DotBotLH2Position(
- x=dotbots[0].lh2_position.x, y=dotbots[0].lh2_position.y, z=0
- )
- ],
- )
-
- await ws.send(
- WSWaypoints(
- cmd="waypoints",
- address=dotbots[0].address,
- application=ApplicationType.DotBot,
- data=waypoints.model_dump(),
- )
- )
-
- await asyncio.sleep(0.25)
+ await asyncio.sleep(0.025)
async def main() -> None:
url = os.getenv("DOTBOT_CONTROLLER_URL", "localhost")
@@ -88,4 +70,4 @@ async def main() -> None:
if __name__ == "__main__":
- asyncio.run(main())
\ No newline at end of file
+ asyncio.run(main()) |
aabadie
approved these changes
Feb 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Update DotBotsMapPoint to use React.memo.
Previously, on every WebSocket update, a new dotbot object was created and replaced the existing one — even when none of its values had actually changed. Because the object reference changed, React treated it as an update and re-rendered all N bots.
As the number of bots increased, the number of updates and unnecessary re-renders also increased, which negatively impacted performance.
The fix ensures that:
Here is some screenshots before:
After: