Skip to content

Conversation

@TPReal
Copy link
Collaborator

@TPReal TPReal commented Oct 9, 2023

No description provided.

if (facilityId) {
return User.statusWithFacilityPermissionsQueryOptions(facilityId);
}
// If the facility is not available, return statusQueryOptions below, which will fail
Copy link
Contributor

Choose a reason for hiding this comment

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

Nie da się uniknąć niepotrzebnych zapytań, jeśli wiadomo że "fail anyway"?

Też nie widać gdzie i czemu "fail anyway", bo pod spodem nie widzę sprawdzania "facility permissions fields".

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Facility permission fields są w localProps.roles. Więc nigdy nie będzie accessGranted skoro ich nie ma w wyniku (są wszystkie false).

Zwracam disabled query.

Copy link
Contributor

Choose a reason for hiding this comment

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

To chyba nadal nie rozumiem, "Return a disabled query, which will be shown as pending"? Pending forever? Dlaczego nie jakiś błąd w takim razie?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Brak facility jest tutaj stanem przejściowym. Jeżeli wynika z tego że to facility w ogóle nie istnieje no to router pokaże jakąś stronę że not found. Więc tutaj to może wynikać z tego, że facilities się jeszcze nie załadowały, no więc pending. W ogóle to jest przypadek którego mi się w praktyce nie udało nawet uzyskać i próbuję go zrobić bez zbędnego kombinowania i możliwie szybko :) Naprawdę nie warto w to rozwiązanie inwestować moim zdaniem.

Copy link
Contributor

Choose a reason for hiding this comment

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

No dobra, ale czyż nie jest najprościej jakieś throw new Error() w takim dziwnym przypadku?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No nie, bo jednak teoretycznie się to może zdarzyć, jeśli na przykład facilities nie są dostępne, bo się jeszcze ładują, czy coś takiego. To nie jest jakiś twardy error, tylko raczej takie poczekamy, zobaczymy, a póki co nie masz dostępu.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, po rozmowie na discord lepiej rozumiem, że to komplikacje solidowe z sekwencyjnym query. Może by tu pomogło zrozumieć coś w stylu "// Return disabled query to wait for facilitiesQuery.data"

No i nadal error facilitiesQuery nie jest obsługiwany poprawnie (zawiśnie na loaderze)? Jak nie ma lepszych pomysłów, to albo dwa QueryBarrier albo przynajmniej poproszę TODO albo komentarz że tak jest i trudno bo np. zadowalamy się toastem na takim zawiśniętym loaderze.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Dodałem podwójne QueryBarrier i wydaje się działać, chociaż może dobrze gdybyś to przeklikał.

@TPReal TPReal requested a review from qelo October 10, 2023 12:41
Rewrote the logging and toast on error response.

createEffect(
// Don't rerun when fields on queries change, just the top level props.
on([() => props.queries, () => props.ignoreCachedData], ([queries, ignoreCachedData]) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

po co on() ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Właśnie linię wyżej jest wyjaśnienie.

if (facilityId) {
return User.statusWithFacilityPermissionsQueryOptions(facilityId);
}
// If the facility is not available, return statusQueryOptions below, which will fail
Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, po rozmowie na discord lepiej rozumiem, że to komplikacje solidowe z sekwencyjnym query. Może by tu pomogło zrozumieć coś w stylu "// Return disabled query to wait for facilitiesQuery.data"

No i nadal error facilitiesQuery nie jest obsługiwany poprawnie (zawiśnie na loaderze)? Jak nie ma lepszych pomysłów, to albo dwa QueryBarrier albo przynajmniej poproszę TODO albo komentarz że tak jest i trudno bo np. zadowalamy się toastem na takim zawiśniętym loaderze.

…states.

Changed prefetching of queries to not keep the queries active.
@TPReal TPReal merged commit ecbef12 into develop Oct 11, 2023
@TPReal TPReal deleted the query-fixes branch October 11, 2023 15:31
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.

3 participants