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

Implement target swap/restore #158

Merged
merged 1 commit into from
Oct 3, 2024
Merged

Conversation

hugo-vrijswijk
Copy link
Contributor

@hugo-vrijswijk hugo-vrijswijk commented Sep 26, 2024

  • Also sets up test to run in vite browser mode, for improved test reliability/closer to actual application
  • Adds a Toast provider so toasts can be called with a simple useToast hook that doesn't require adding a toast and ref for each component
  • Log graphql errors to console instead of silently swallowing
  • Enable some useful linting rules again

@hugo-vrijswijk hugo-vrijswijk force-pushed the sc-3283-implement-target-swap branch 2 times, most recently from 6636e26 to 7de34d5 Compare September 26, 2024 14:24
@@ -0,0 +1,98 @@
import { useCanEdit } from '@/components/atoms/auth';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

When reviewing, mainly look at this file

@@ -23,17 +23,17 @@ export function OdbImport() {
const rotator = useRotator().data?.rotator;

function updateObs() {
updateConfiguration({
void updateConfiguration({
Copy link
Contributor

Choose a reason for hiding this comment

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

Just to learn 😅
Why is this void needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question! I updated the linting rules to not allow "floating promises" which are promise-returning functions that are never awaited. It's a great rule that can catch bugs, but in cases like these where it's an event handler we have to "discard" the promise (void)

Copy link
Contributor

Choose a reason for hiding this comment

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

Awesome, thank you for the explanation.

Copy link
Contributor

Choose a reason for hiding this comment

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

Awesome, much better solution. It is like using shadcn/ui.

const [swapTarget, { loading: swapLoading }] = useSwapTarget();
const [restoreTarget, { loading: restoreLoading }] = useRestoreTarget();

const { data: instrumentData, loading: instrumentLoading } = useInstrument();
Copy link
Contributor

@dngomez dngomez Sep 30, 2024

Choose a reason for hiding this comment

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

I think this will cause the same problem we had in the tests last Friday, where instrument was always undefined, because we are not passing the required variables name, issPort and wfs.

@hugo-vrijswijk hugo-vrijswijk marked this pull request as ready for review October 3, 2024 14:25
Copy link
Contributor

@dngomez dngomez left a comment

Choose a reason for hiding this comment

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

LGTM!

@hugo-vrijswijk hugo-vrijswijk merged commit 15bc77f into main Oct 3, 2024
3 checks passed
@hugo-vrijswijk hugo-vrijswijk deleted the sc-3283-implement-target-swap branch October 3, 2024 15:50
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.

2 participants