Studio: Add site does not duplicate sites#2415
Conversation
bcotrim
left a comment
There was a problem hiding this comment.
Thanks @katinthehatsite for looking into this issue.
We already do a similar check in the main process before emitting the site-event event to the UI.
Have you confirmed what is the issue with that check? It would be preferable to keep the logic in the main process and leave the UI as simple as possible, in my opinion.
📊 Performance Test ResultsComparing bc0c681 vs trunk site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change |
I forgot to add the link to the existing check: |
8d5bef1 to
9dfaf8c
Compare
473448a to
dc22e10
Compare
I see, thanks for adding the link @bcotrim . I looked into the check and it seems that it exited the main process correctly but did not notify the renderer process about the exit properly. I made some changes to |
bcotrim
left a comment
There was a problem hiding this comment.
Thanks for finding and fixing the issue @katinthehatsite
Nit: If we move sendIpcEventToRenderer inside the handleSiteEvent function, we could structure it with early returns for the "don't send" cases and a single send at the end. In my opinion, it makes the function intention easier to read and understand.
…te-sites-added-to-sidebar
Thanks for the suggestion! I did the refactor in bc0c681 |
Related issues
Fixes STU-1210
Proposed Changes
This PR ensures that when you add a site from
Add sitein the sidebar, only one site gets added and there is no duplication.Testing Instructions
npm startAdd sitePre-merge Checklist