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

Add the ability to search courses in the modal #5023

Merged
merged 8 commits into from
Apr 22, 2022

Conversation

donnapep
Copy link
Collaborator

@donnapep donnapep commented Apr 13, 2022

Partial fix for #4959.

Changes proposed in this Pull Request

This PR adds the ability to search for specific courses in the modal.

Testing instructions

  • Open the modal on the Students page.
  • The spinner should be displayed while courses are being searched.
  • Open the Network > Fetch/XHR tab in DevTools.
  • Enter some text to search for.
  • Depending on how fast you type, you should not see an API call for every keystroke. The API is called 400ms after you stop typing.
  • Ensure that the height of the course list (bordered area) remains fixed and is not jumpy when moving between the following states:
    • When the loading spinner is displayed
    • When courses are displayed
    • When no courses are found

Screenshot / Video

Loading

loading

No Courses

empty

Course List

courses

@donnapep donnapep self-assigned this Apr 13, 2022
@donnapep donnapep added this to the 4.4.0 - Student Management milestone Apr 13, 2022
@donnapep donnapep marked this pull request as ready for review April 13, 2022 16:19
@donnapep donnapep requested a review from a team April 13, 2022 16:19
@donnapep
Copy link
Collaborator Author

donnapep commented Apr 13, 2022

@gabrielcaires I think I found another case where useCallback is a good idea (i.e. when debouncing).

@donnapep
Copy link
Collaborator Author

@Luchadores Please see the screen shots in the description. I set a fixed height of 300px on the box where the courses display to prevent the modal's height from growing / shrinking as the user searches for courses.

@Luchadores
Copy link

Hey @donnapep 👋 Looks good!

  • Could we make the search bar a bit taller? 36px height should make it look better.
  • The width of the entire modal seems quite big. I'm not sure as I'm not seeing it in context. But should be around 460px in width.

Thank you 🙌

@gabrielcaires
Copy link
Contributor

gabrielcaires commented Apr 13, 2022

@gabrielcaires I think I found [another case where useCallback is a good idea

Oh interesting , I never saw this kind of usage before! 🎉

@donnapep I think this PR just be integrated with the PR #5017 instead of feature/student-management

@donnapep donnapep force-pushed the add/search-courses branch 2 times, most recently from 248d407 to 721df89 Compare April 14, 2022 19:38
@donnapep donnapep marked this pull request as draft April 14, 2022 19:40
@donnapep donnapep force-pushed the add/search-courses branch 2 times, most recently from e1c390b to 7546c28 Compare April 15, 2022 00:10
@merkushin
Copy link
Member

Unfortunately, it doesn't work for me :(

CleanShot.2022-04-17.at.01.46.45.mp4

It looks like I get a response from WP, but it does not render the list.
Also, I noticed the modal looks weird: I see a scrollbar when open the inspector.

@donnapep
Copy link
Collaborator Author

donnapep commented Apr 18, 2022

It looks like I get a response from WP, but it does not render the list.

I had to move this back to Draft status a bit ago in order to get Gabriel's changes. I'm leaving it in Draft for now because the changes broke some things.

@donnapep donnapep marked this pull request as ready for review April 19, 2022 18:31
@donnapep
Copy link
Collaborator Author

donnapep commented Apr 19, 2022

@gabrielcaires You may be annoyed by me. 😳 I removed the isMounted check as it completely broke search (the component would unmount, and after the API call returned the isMounted.current test would not pass and the spinner would just keep spinning).

I opted to remove it since getting this PR moving felt more important than fixing the original React warning. I know you were looking into an alternate solution as well, so hopefully we can address it in a separate PR and find a solution that eliminates the original warning while also not impacting the search functionality.

@gabrielcaires
Copy link
Contributor

gabrielcaires commented Apr 19, 2022

After the removal, Are you seeing warning messages related to run set state after components was unmounted?

@donnapep
Copy link
Collaborator Author

donnapep commented Apr 19, 2022

After the removal, Are you seeing warning messages related to run set state after components was unmounted?

Yup, in the tests I do, and I'm aware that this was the original issue you were trying to fix.

@merkushin
Copy link
Member

merkushin commented Apr 21, 2022

Works well 👍

On the list, I found we escape titles too many times:
CleanShot 2022-04-21 at 20 34 41@2x

Original titles:
CleanShot 2022-04-21 at 20 39 16@2x

Also, there is a conflict here.

@donnapep
Copy link
Collaborator Author

On the list, I found we escape titles too many times

I'll create a new card for this since it's unrelated to this particular PR. I resolved the conflict though.

@donnapep donnapep merged commit 0f058f3 into feature/student-management Apr 22, 2022
@donnapep donnapep deleted the add/search-courses branch April 22, 2022 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants