Skip to content
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

refactor(app-shell, app-shell-odd): Refactor app to use unsubscribe flags #14633

Closed
wants to merge 14 commits into from

Conversation

mjhuff
Copy link
Contributor

@mjhuff mjhuff commented Mar 12, 2024

Closes EXEC-306

Overview

This is the frontend implementation of #14620. See that PR and its corresponding ticket for the explanation behind this refactor.

Test Plan

  • Push refactor(robot-server): Utilize unsubscribe flags for dynamic topics #14620 to a robot.
  • Open the desktop app and smoke test running a protocol and opening/closing a maintenance run flow. Note that there shouldn't be any unsubscribe actions dispatched.
  • During a protocol run, cancel the run.
  • You should see an app-shell(-odd) log about being "successfully unsubscribed."
  • You can repeat the same steps on the ODD if you'd like, but the code is nearly identical.

Risk assessment

low

@mjhuff mjhuff requested a review from a team March 12, 2024 14:56
const { client } = connectionStore[hostname]
client?.unsubscribe(topic, {}, (error, result) => {
if (error != null) {
// log.warn(
Copy link
Member

Choose a reason for hiding this comment

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

might want this back but definitely don't want it commented - let's uncomment or delete

}, RENDER_TIMEOUT)
})
} else {
// log.info(
Copy link
Member

Choose a reason for hiding this comment

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

let's uncomment or delete

@@ -434,3 +391,14 @@ function sendToBrowserDeserialized({

browserWindow.webContents.send('notify', hostname, topic, deserializedMessage)
}

function deserialize(message: string): string | Record<string, unknown> {
Copy link
Member

Choose a reason for hiding this comment

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

Is there a case where this will be (a) valid and (b) not json? if so can we remove that case, and make this be a Promise<Record<string, unknown>> or even better a Promise<NotifyMessage> with a small list of valid models that rejects if it doesn't parse?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah good point

@mjhuff
Copy link
Contributor Author

mjhuff commented Mar 12, 2024

Soooo, I borked this PR (but the feedback I'll carry over!).

Turns out I manufactured the end result that assumes discovery-client handles the connection logic alongside the unsubscribe logic. That's what I get for doing too many things on too many branches at once.

Correcting this PR without creating a complex intermediary solution that utilizes the backend unsubscribe flags seems pretty pointless, as does changing one variable on the app side that refetches on the unsubscribe flag.

I'll just re-open a PR with the end result that includes the discovery-client logic. That way, the node layer actually makes use of the new unsubscribe flags.

@mjhuff mjhuff closed this Mar 12, 2024
@mjhuff mjhuff deleted the refactor-shell-notify-subscriptions branch April 8, 2024 16:21
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.

None yet

2 participants