Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

(fix) O3-3199: Service Queues - queue table not updated after transitioning a queue entry #1178

Merged
merged 12 commits into from
Jun 17, 2024

Conversation

brandones
Copy link
Contributor

Requirements

  • This PR has a title that briefly describes the work done including the ticket number. If there is a ticket, make sure your PR title includes a conventional commit label. See existing PR titles for inspiration.
  • My work conforms to the OpenMRS 3.0 Styleguide and design documentation.
  • My work includes tests or is validated by existing tests.

Summary

useSWRInfinite does not work with mutate. So I implemented a custom paging SWR hook that supports mutation. I tried writing tests and failed. If we eventually decide to turn this into a more generic paging data hook, we will need to write tests. Also, it retains the original behavior of just downloading all the data at once, iteratively downloading every page.

Screenshots

recording-2024-06-06_16.36.51.mp4

Related Issue

https://issues.openmrs.org/browse/O3-3199

Other

Copy link
Contributor

github-actions bot commented Jun 6, 2024

Size Change: -51.8 kB (-1.47%)

Total Size: 3.47 MB

Filename Size Change
packages/esm-service-queues-app/dist/200.js 0 B -49.5 kB (removed) 🏆
ℹ️ View Unchanged
Filename Size Change
packages/esm-active-visits-app/dist/130.js 178 kB 0 B
packages/esm-active-visits-app/dist/255.js 2.5 kB 0 B
packages/esm-active-visits-app/dist/271.js 783 B 0 B
packages/esm-active-visits-app/dist/316.js 42.9 kB 0 B
packages/esm-active-visits-app/dist/319.js 687 B 0 B
packages/esm-active-visits-app/dist/382.js 1.22 kB 0 B
packages/esm-active-visits-app/dist/443.js 6.98 kB 0 B
packages/esm-active-visits-app/dist/460.js 794 B 0 B
packages/esm-active-visits-app/dist/574.js 592 B 0 B
packages/esm-active-visits-app/dist/635.js 1.22 kB 0 B
packages/esm-active-visits-app/dist/644.js 783 B 0 B
packages/esm-active-visits-app/dist/729.js 3.08 kB 0 B
packages/esm-active-visits-app/dist/757.js 700 B 0 B
packages/esm-active-visits-app/dist/784.js 2.63 kB 0 B
packages/esm-active-visits-app/dist/788.js 590 B 0 B
packages/esm-active-visits-app/dist/807.js 935 B 0 B
packages/esm-active-visits-app/dist/833.js 742 B 0 B
packages/esm-active-visits-app/dist/835.js 14.2 kB 0 B
packages/esm-active-visits-app/dist/875.js 50.5 kB 0 B
packages/esm-active-visits-app/dist/879.js 3.02 kB 0 B
packages/esm-active-visits-app/dist/main.js 69.5 kB 0 B
packages/esm-active-visits-app/dist/openmrs-esm-active-visits-app.js 3.33 kB 0 B
packages/esm-appointments-app/dist/130.js 178 kB 0 B
packages/esm-appointments-app/dist/152.js 259 B 0 B
packages/esm-appointments-app/dist/224.js 42.1 kB -1 B (0%)
packages/esm-appointments-app/dist/255.js 2.51 kB 0 B
packages/esm-appointments-app/dist/271.js 1.99 kB 0 B
packages/esm-appointments-app/dist/303.js 259 B 0 B
packages/esm-appointments-app/dist/309.js 879 B 0 B
packages/esm-appointments-app/dist/319.js 1.88 kB 0 B
packages/esm-appointments-app/dist/4.js 1.78 kB 0 B
packages/esm-appointments-app/dist/445.js 249 kB 0 B
packages/esm-appointments-app/dist/460.js 2.09 kB 0 B
packages/esm-appointments-app/dist/501.js 7.02 kB 0 B
packages/esm-appointments-app/dist/574.js 1.92 kB -14 B (-0.72%)
packages/esm-appointments-app/dist/591.js 16.8 kB 0 B
packages/esm-appointments-app/dist/644.js 1.99 kB 0 B
packages/esm-appointments-app/dist/729.js 3.08 kB 0 B
packages/esm-appointments-app/dist/757.js 1.75 kB 0 B
packages/esm-appointments-app/dist/784.js 2.62 kB 0 B
packages/esm-appointments-app/dist/788.js 1.69 kB 0 B
packages/esm-appointments-app/dist/807.js 2.31 kB 0 B
packages/esm-appointments-app/dist/833.js 1.98 kB 0 B
packages/esm-appointments-app/dist/857.js 14.2 kB 0 B
packages/esm-appointments-app/dist/904.js 20.7 kB 0 B
packages/esm-appointments-app/dist/main.js 307 kB -3 B (0%)
packages/esm-appointments-app/dist/openmrs-esm-appointments-app.js 3.39 kB 0 B
packages/esm-patient-list-management-app/dist/130.js 178 kB 0 B
packages/esm-patient-list-management-app/dist/139.js 22.4 kB 0 B
packages/esm-patient-list-management-app/dist/255.js 2.51 kB 0 B
packages/esm-patient-list-management-app/dist/271.js 1.58 kB 0 B
packages/esm-patient-list-management-app/dist/319.js 1.51 kB 0 B
packages/esm-patient-list-management-app/dist/382.js 1.23 kB 0 B
packages/esm-patient-list-management-app/dist/443.js 6.98 kB 0 B
packages/esm-patient-list-management-app/dist/460.js 1.72 kB 0 B
packages/esm-patient-list-management-app/dist/548.js 4.79 kB 0 B
packages/esm-patient-list-management-app/dist/574.js 1.34 kB 0 B
packages/esm-patient-list-management-app/dist/591.js 16.9 kB 0 B
packages/esm-patient-list-management-app/dist/635.js 1.23 kB 0 B
packages/esm-patient-list-management-app/dist/644.js 1.58 kB 0 B
packages/esm-patient-list-management-app/dist/729.js 3.08 kB 0 B
packages/esm-patient-list-management-app/dist/757.js 1.5 kB 0 B
packages/esm-patient-list-management-app/dist/784.js 2.63 kB 0 B
packages/esm-patient-list-management-app/dist/788.js 1.34 kB 0 B
packages/esm-patient-list-management-app/dist/807.js 1.85 kB 0 B
packages/esm-patient-list-management-app/dist/833.js 1.59 kB 0 B
packages/esm-patient-list-management-app/dist/930.js 98.3 kB 0 B
packages/esm-patient-list-management-app/dist/main.js 125 kB 0 B
packages/esm-patient-list-management-app/dist/openmrs-esm-patient-list-management-app.js 3.31 kB 0 B
packages/esm-patient-registration-app/dist/130.js 177 kB 0 B
packages/esm-patient-registration-app/dist/152.js 264 B 0 B
packages/esm-patient-registration-app/dist/169.js 6.71 kB 0 B
packages/esm-patient-registration-app/dist/207.js 2.44 kB 0 B
packages/esm-patient-registration-app/dist/255.js 2.5 kB 0 B
packages/esm-patient-registration-app/dist/271.js 2.05 kB 0 B
packages/esm-patient-registration-app/dist/303.js 264 B 0 B
packages/esm-patient-registration-app/dist/319.js 1.99 kB 0 B
packages/esm-patient-registration-app/dist/34.js 61.3 kB 0 B
packages/esm-patient-registration-app/dist/371.js 547 B 0 B
packages/esm-patient-registration-app/dist/460.js 2.15 kB 0 B
packages/esm-patient-registration-app/dist/501.js 7.03 kB 0 B
packages/esm-patient-registration-app/dist/572.js 37.2 kB 0 B
packages/esm-patient-registration-app/dist/574.js 1.71 kB 0 B
packages/esm-patient-registration-app/dist/591.js 16.8 kB 0 B
packages/esm-patient-registration-app/dist/644.js 2.05 kB 0 B
packages/esm-patient-registration-app/dist/729.js 3.08 kB 0 B
packages/esm-patient-registration-app/dist/735.js 465 B 0 B
packages/esm-patient-registration-app/dist/757.js 2.08 kB 0 B
packages/esm-patient-registration-app/dist/784.js 2.63 kB 0 B
packages/esm-patient-registration-app/dist/788.js 1.71 kB 0 B
packages/esm-patient-registration-app/dist/807.js 2.45 kB 0 B
packages/esm-patient-registration-app/dist/833.js 1.99 kB 0 B
packages/esm-patient-registration-app/dist/879.js 3.03 kB 0 B
packages/esm-patient-registration-app/dist/main.js 101 kB 0 B
packages/esm-patient-registration-app/dist/openmrs-esm-patient-registration-app.js 3.35 kB 0 B
packages/esm-patient-search-app/dist/130.js 178 kB 0 B
packages/esm-patient-search-app/dist/255.js 2.5 kB 0 B
packages/esm-patient-search-app/dist/271.js 920 B 0 B
packages/esm-patient-search-app/dist/299.js 23.2 kB 0 B
packages/esm-patient-search-app/dist/319.js 861 B 0 B
packages/esm-patient-search-app/dist/354.js 22 kB 0 B
packages/esm-patient-search-app/dist/382.js 1.23 kB 0 B
packages/esm-patient-search-app/dist/443.js 6.98 kB 0 B
packages/esm-patient-search-app/dist/460.js 939 B 0 B
packages/esm-patient-search-app/dist/574.js 742 B 0 B
packages/esm-patient-search-app/dist/591.js 16.8 kB 0 B
packages/esm-patient-search-app/dist/635.js 1.23 kB 0 B
packages/esm-patient-search-app/dist/644.js 920 B 0 B
packages/esm-patient-search-app/dist/729.js 3.08 kB 0 B
packages/esm-patient-search-app/dist/757.js 871 B 0 B
packages/esm-patient-search-app/dist/784.js 2.63 kB 0 B
packages/esm-patient-search-app/dist/788.js 736 B 0 B
packages/esm-patient-search-app/dist/807.js 1.04 kB 0 B
packages/esm-patient-search-app/dist/833.js 877 B 0 B
packages/esm-patient-search-app/dist/main.js 48.6 kB 0 B
packages/esm-patient-search-app/dist/openmrs-esm-patient-search-app.js 3.3 kB 0 B
packages/esm-service-queues-app/dist/130.js 178 kB 0 B
packages/esm-service-queues-app/dist/152.js 261 B 0 B
packages/esm-service-queues-app/dist/169.js 6.98 kB 0 B
packages/esm-service-queues-app/dist/233.js 1.75 kB +2 B (+0.11%)
packages/esm-service-queues-app/dist/237.js 3.17 kB 0 B
packages/esm-service-queues-app/dist/255.js 2.51 kB -8 B (-0.32%)
packages/esm-service-queues-app/dist/271.js 4.17 kB 0 B
packages/esm-service-queues-app/dist/276.js 2.25 kB +1 B (+0.04%)
packages/esm-service-queues-app/dist/303.js 261 B 0 B
packages/esm-service-queues-app/dist/319.js 3.55 kB 0 B
packages/esm-service-queues-app/dist/382.js 0 B -1.23 kB (removed) 🏆
packages/esm-service-queues-app/dist/401.js 3.06 kB -1 B (-0.03%)
packages/esm-service-queues-app/dist/430.js 156 kB 0 B
packages/esm-service-queues-app/dist/460.js 4.42 kB 0 B
packages/esm-service-queues-app/dist/501.js 7.03 kB 0 B
packages/esm-service-queues-app/dist/54.js 49.8 kB 0 B
packages/esm-service-queues-app/dist/574.js 3.84 kB 0 B
packages/esm-service-queues-app/dist/591.js 16.8 kB 0 B
packages/esm-service-queues-app/dist/635.js 0 B -1.23 kB (removed) 🏆
packages/esm-service-queues-app/dist/644.js 4.17 kB 0 B
packages/esm-service-queues-app/dist/650.js 3.29 kB 0 B
packages/esm-service-queues-app/dist/669.js 3.2 kB 0 B
packages/esm-service-queues-app/dist/696.js 1.39 kB 0 B
packages/esm-service-queues-app/dist/703.js 4.17 kB 0 B
packages/esm-service-queues-app/dist/729.js 3.08 kB 0 B
packages/esm-service-queues-app/dist/738.js 1.35 kB 0 B
packages/esm-service-queues-app/dist/757.js 3.55 kB 0 B
packages/esm-service-queues-app/dist/764.js 2.61 kB 0 B
packages/esm-service-queues-app/dist/784.js 2.63 kB 0 B
packages/esm-service-queues-app/dist/788.js 3.54 kB 0 B
packages/esm-service-queues-app/dist/806.js 1.62 kB +1 B (+0.06%)
packages/esm-service-queues-app/dist/807.js 4.84 kB 0 B
packages/esm-service-queues-app/dist/833.js 4.11 kB 0 B
packages/esm-service-queues-app/dist/877.js 2.98 kB 0 B
packages/esm-service-queues-app/dist/894.js 2.38 kB 0 B
packages/esm-service-queues-app/dist/917.js 2.78 kB 0 B
packages/esm-service-queues-app/dist/940.js 21.4 kB 0 B
packages/esm-service-queues-app/dist/981.js 1.68 kB 0 B
packages/esm-service-queues-app/dist/main.js 208 kB +257 B (+0.12%)
packages/esm-service-queues-app/dist/openmrs-esm-service-queues-app.js 3.31 kB -36 B (-1.07%)
packages/esm-ward-app/dist/114.js 3.42 kB 0 B
packages/esm-ward-app/dist/130.js 178 kB 0 B
packages/esm-ward-app/dist/443.js 6.97 kB 0 B
packages/esm-ward-app/dist/574.js 278 B 0 B
packages/esm-ward-app/dist/591.js 16.8 kB 0 B
packages/esm-ward-app/dist/663.js 14.4 kB 0 B
packages/esm-ward-app/dist/729.js 3.07 kB 0 B
packages/esm-ward-app/dist/784.js 2.62 kB 0 B
packages/esm-ward-app/dist/main.js 20.1 kB 0 B
packages/esm-ward-app/dist/openmrs-esm-ward-app.js 3.22 kB 0 B

compressed-size-action

@@ -41,7 +41,7 @@ describe('Home Component', () => {
window.location = { pathname: '/some-path/screen' };

render(<Home />);
expect(screen.getByRole('progressbar')).toBeInTheDocument();
expect(screen.getByText(/patients currently in queue/i)).toBeInTheDocument();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@donaldkibet I don't really know why this test broke. Could you confirm that I'm not breaking anything that shouldn't be broken?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I'll take the thumbs up as meaning "this change seems fine."

@brandones brandones requested a review from chibongho June 6, 2024 21:13
Copy link
Contributor

@chibongho chibongho left a comment

Choose a reason for hiding this comment

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

Looks reasonable enough, but I'd really want to do some testing myself before approving it. I wouldn't be surprised if there is an off-by-one error either ':-)

if (data && data.length && data?.[data?.length - 1]?.data?.links?.some((link) => link.rel === 'next')) {
// Calling for the next set of data
setSize((prev) => prev + 1);
const nextUrl = getNextUrlFromResponse(pageData);
Copy link
Contributor

Choose a reason for hiding this comment

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

indent

Copy link
Contributor Author

Choose a reason for hiding this comment

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

?

Prettier handles things like indentation so we don't have to think about it (and so it can't be wrong)

@brandones
Copy link
Contributor Author

@chibongho Per our conversation, I have made it so that tables show data as soon as they get that data, even if more data is still loading. Demo with limit=3

recording-2024-06-12_13.10.07.mp4

@brandones
Copy link
Contributor Author

I'll fix the E2E tests soon. Apparently Playwright doesn't support non-LTS Ubuntu, which is nuts. So I guess it's time to upgrade to 24.04.

Copy link
Contributor

@chibongho chibongho left a comment

Choose a reason for hiding this comment

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

Looks great! thanks.

@brandones
Copy link
Contributor Author

The E2E tests are failing due to https://openmrs.atlassian.net/browse/O3-3401

@brandones brandones merged commit 5ed79a4 into main Jun 17, 2024
6 checks passed
@brandones brandones deleted the O3-3199-mutate branch June 17, 2024 15:17
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants