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

#95 + #96: To-do facturen + automatische deployment #20

Merged

Conversation

rickdenhaan
Copy link
Contributor

Deployment gebeurt (als het goed is) automatisch wanneer in Github een Release wordt aangemaakt en gepublished.

…) is iets mee moet/kan.

+ Package updates (Expo patch van 49.0.13 naar 49.0.16 + bijbehorende updates)
+ Bugfix: app crasht soms na wisselen omgeving omdat de `url` in `data.nativeEvent` NULL kan zijn

Extra loader toegevoegd aan SwitchEnvironmentScreen omdat soms het Dashboard al geladen werd terwijl de teller van het aantal openstaande to-do's nog niet was gereset na het wisselen van de omgeving. Nu wordt die navigatiestap pas gedaan nadat de query cache geleegd is.
Comment on lines 25 to 31
setIsResetting(true);
queryClient
.resetQueries()
.finally(() => {
setIsResetting(false);
navigation.navigate('Dashboard');
});
Copy link
Collaborator

Choose a reason for hiding this comment

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

Gewoon await hiervoor gebruiken lijkt mij. Je kan gewoon state setten na de await weer terugzetten.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Behalve dat als er een error optreedt tijdens resetQueries de gebruiker vast zit op een loading scherm en de app zelf moet force-killen. Dat is ook waarom ik dit in .finally() doe en niet in .then().

Copy link
Collaborator

Choose a reason for hiding this comment

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

Je kan de await in try catch doen met een finall heb hetzelfde effect...
Je kan dan zelf de fetch weghalen.

Ik zie hier ook in de documentatie dat je errors kan negeren. door op options throwOnError op false te zetten

https://tanstack.com/query/v4/docs/react/reference/QueryClient#queryclientresetqueries

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Aangepast naar await. Als er een error optreedt dan wordt die netjes doorgestuurd naar de parent promise nu.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Kan je aanwijzen welke parent promise dit afhandeld? want ik kan het niet in de commit zien.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Deze onRefreshToken is zelf een async functie en returnt dus een promise.

Dus wanneer queryClient.resetQueries() een error throwt, wordt die nu gerethrowt en kan die worden afgevangen op de plaats waar onRefreshToken wordt aangeroepen met onRefreshToken().catch(), in plaats van dat die stilletjes verdwijnt naar de window.onunhandledrejection handler.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oke duidelijk

…) is iets mee moet/kan.

+ Review comments, use await on resetQueries instead of finally
@rickdenhaan rickdenhaan merged commit 106460d into develop Oct 24, 2023
2 checks passed
@rickdenhaan rickdenhaan deleted the feature/#96/show-todo-invoices-instead-of-to-approve branch October 24, 2023 08:16
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