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: remove store #495

Merged
merged 57 commits into from
May 15, 2023
Merged

refactor: remove store #495

merged 57 commits into from
May 15, 2023

Conversation

ismay
Copy link
Contributor

@ismay ismay commented Apr 25, 2023

Removing the store and moving to individual data fetching hooks to prepare for the new endpoints.

Preparing for:

Follow up

@ismay ismay force-pushed the job-queues-new branch 2 times, most recently from 10c2c98 to be3fe05 Compare April 25, 2023 14:54
@dhis2-bot
Copy link
Contributor

dhis2-bot commented Apr 25, 2023

🚀 Deployed on https://pr-495--dhis2-scheduler.netlify.app

@dhis2-bot dhis2-bot temporarily deployed to netlify April 25, 2023 14:56 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify April 26, 2023 10:07 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify April 26, 2023 10:09 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify April 26, 2023 10:13 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify April 26, 2023 14:23 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify April 26, 2023 15:16 Inactive
@ismay ismay marked this pull request as ready for review May 1, 2023 08:34
@ismay ismay requested review from a team as code owners May 1, 2023 08:34
Copy link
Contributor

@Mohammer5 Mohammer5 left a comment

Choose a reason for hiding this comment

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

Code looks good and apps seems to work as well. I only have a few suggestions, but I don't request any changes.

  • I think it'd make sense to add a src/hooks/index.js so you don't have to import hooks from specific folders but just from ../../hooks/index.js
  • I've added some comments about using the export { default as ... } from '...' syntax, there are more files to which this comment applies, I just didn't add a comment to those files

src/components/JobTable/Actions.js Outdated Show resolved Hide resolved
src/components/JobTable/Actions.js Outdated Show resolved Hide resolved
src/hooks/job-schedules/index.js Outdated Show resolved Hide resolved
src/hooks/job-schedules/use-job-schedules.js Show resolved Hide resolved
src/hooks/job-schedules/use-job-schedules.js Outdated Show resolved Hide resolved
src/hooks/job-types/use-job-type-parameters.js Outdated Show resolved Hide resolved
src/hooks/parameter-options/index.js Outdated Show resolved Hide resolved
src/pages/JobList/JobList.js Outdated Show resolved Hide resolved
@ismay
Copy link
Contributor Author

ismay commented May 2, 2023

* I think it'd make sense to add a `src/hooks/index.js` so you don't have to import hooks from specific folders but just from `../../hooks/index.js`

I made this change, but it confuses the eslint import plugin. It can no longer follow the imports it seems, and we get an error about an unused module. Since this plugin is pretty useful for catching unused modules and broken imports I've reverted the change. I figured it's more important to have this properly linted than to have the benefits of the terser import style.

@ismay ismay force-pushed the job-queues-new branch 2 times, most recently from 6735fda to 2436e32 Compare May 3, 2023 09:27
@dhis2-bot dhis2-bot temporarily deployed to netlify May 3, 2023 09:40 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify May 3, 2023 11:18 Inactive
@ismay ismay requested a review from a team May 3, 2023 11:58
@dhis2-bot dhis2-bot temporarily deployed to netlify May 3, 2023 14:42 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify May 3, 2023 14:59 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify May 3, 2023 15:16 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify May 8, 2023 16:01 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify May 9, 2023 13:45 Inactive
Copy link
Member

@tomzemp tomzemp left a comment

Choose a reason for hiding this comment

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

Looks good to me! I just did a high-level QA-type review (as I think that is what the second review was supposed to be), so just briefly skimming through the code changes and looking at the app. App looked like it worked well.

A couple of things that I noticed:

  • the structure of useParameterOptions/useParameterOption hooks seems to result in unnecessary requests. Like if I select 'monitoring' as the job type, then the structure of the query also means that predictors, predictorGroups, dataIntegrity endpoints get requested even though it seems like for this job type, we just need the information from validationRuleGroups? Since the requests aren't very large and the app is more specialized, I think it's not going to cause issues, but it was something I noticed.
  • it's cool that failed requests are minimally blocking, but it seems a bit hard to notice with the help text:
    image
    Also, in some cases, like with job type push analysis, the select is disabled/non-blocking, but then it seems that one cannot create a valid job. I just wonder if it would be better with something slightly more prominent, or at least a message along the lines of "try refreshing the page" in the help text? If this is the agreed design, please disregard my comment.
  • there's some warnings in the console Data queries should always specify fields to return. Not sure if you think it's worth it to update the query to get rid of those or not

@ismay
Copy link
Contributor Author

ismay commented May 10, 2023

Thanks for the review!

Looks good to me! I just did a high-level QA-type review (as I think that is what the second review was supposed to be), so just briefly skimming through the code changes and looking at the app.

Yeah exactly, my thinking as well.

A couple of things that I noticed:

  • the structure of useParameterOptions/useParameterOption hooks seems to result in unnecessary requests. Like if I select 'monitoring' as the job type, then the structure of the query also means that predictors, predictorGroups, dataIntegrity endpoints get requested even though it seems like for this job type, we just need the information from validationRuleGroups? Since the requests aren't very large and the app is more specialized, I think it's not going to cause issues, but it was something I noticed.

  • it's cool that failed requests are minimally blocking, but it seems a bit hard to notice with the help text:
    image
    Also, in some cases, like with job type push analysis, the select is disabled/non-blocking, but then it seems that one cannot create a valid job. I just wonder if it would be better with something slightly more prominent, or at least a message along the lines of "try refreshing the page" in the help text? If this is the agreed design, please disregard my comment.

  • there's some warnings in the console Data queries should always specify fields to return. Not sure if you think it's worth it to update the query to get rid of those or not

Yeah those are all good points.

  • The useParameterOptions hook should probably be broken up into separate hooks. As you say, no need to request unnecessary data. I think that that will be good to tackle along with the upcoming move to a less dynamic app. Then we'll be able to match each field with its own query.
  • For the fields notifying the user about errors, maybe a better solution would be to use the validationText with an error label (https://ui.dhis2.nu/demo/?path=/story/single-select-field--status-error). Though it seems slightly wrong to me semantically, it does yield a more prominent message. Or, we could also render a noticebox instead of the input. Bit jarring, but less wrong semantically and it does not seem wrong to attract the user's attention since there's an error anyway.
  • And yeah, some of the queries still aren't as specific as they should be. I've noted it under the follow up points. I do think it's good to address, as well as getting rid of the unpaginated queries.

Let me know what you think!

@tomzemp
Copy link
Member

tomzemp commented May 10, 2023

Sounds good on those points 👍

For the fields notifying the user about errors, maybe a better solution would be to use the validationText with an error label (https://ui.dhis2.nu/demo/?path=/story/single-select-field--status-error). Though it seems slightly wrong to me semantically, it does yield a more prominent message. Or, we could also render a noticebox instead of the input. Bit jarring, but less wrong semantically and it does not seem wrong to attract the user's attention since there's an error anyway.

Yeah. I was wondering the same what would be appropriate here. I guess a noticebox without a title would not be too intrusive? Maybe Joe would want to weigh in?

@ismay
Copy link
Contributor Author

ismay commented May 10, 2023

Yeah. I was wondering the same what would be appropriate here. I guess a noticebox without a title would not be too intrusive?

Yeah that sounds good to me. I'm already doing that in several places, so it also fits well with the existing patterns. I'll add it to the follow ups. Once the queue functionality has landed we could ask Joe to take a look at these patterns.

@ismay ismay force-pushed the job-queues-new branch from ab760cf to 10cfe63 Compare May 15, 2023 15:02
@dhis2-bot dhis2-bot temporarily deployed to netlify May 15, 2023 15:03 Inactive
@ismay ismay marked this pull request as ready for review May 15, 2023 15:05
@dhis2-bot dhis2-bot temporarily deployed to netlify May 15, 2023 15:08 Inactive
@ismay ismay merged commit fa777b6 into master May 15, 2023
@ismay ismay deleted the job-queues-new branch May 15, 2023 15:15
dhis2-bot added a commit that referenced this pull request May 15, 2023
# [100.4.0](v100.3.0...v100.4.0) (2023-05-15)

### Features

* remove store ([#495](#495)) ([fa777b6](fa777b6))
@dhis2-bot
Copy link
Contributor

🎉 This PR is included in version 100.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants