-
Notifications
You must be signed in to change notification settings - Fork 897
refactor: poll for git auth updates when creating a workspace #9804
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
Conversation
Remaining improvements I wanna do before merging:
Shouldn't be hard, but I wanted to get this PR up before I quit for the day |
I will wait for the remaining work before approve it 👍 |
Also I'm missing tests to avoid any kind of regressions, do you think we could add some coverage to it? |
export const watchGitAuthRefresh = (callback: () => void) => { | ||
const bc = new BroadcastChannel(REFRESH_GITAUTH_BROADCAST_CHANNEL); | ||
bc.addEventListener("message", callback); | ||
return bc; | ||
}; |
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.
I'm confused... this 100% was working, it's in fact how it worked until this entire time.
This removes the need to poll, and generally, we should avoid idle polling on pages. If users leave the "Create Workspace" page up, I don't think it's fair that an operator needs to consume more API requests.
This was a proper regression if it stopped working, not just existing code that didn't work!
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.
This is a little different than that case, because it has a timeout where it will stop polling until the user interacts again, so this definitely won't be an "increases load by xx%" type of thing. I get the appeal of BroadcastChannel
, but I've always found that it ends up being fragile for stuff like this.
I've spent a bit of time trying to figure out how the There's also some other good cleanup stuff in this PR that I want to get merged, so I'm just gonna go with this as-is since it's tested and working. If we want to revisit |
Closes #9536
gitAuth
management out of xstateBroadcastChannel
stuff that wasn't working (and didn't even seem fully implemented)