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

Improved class fetching logic by separating states #238

Merged
merged 5 commits into from
Aug 9, 2024

Conversation

tomaspalma
Copy link
Member

@tomaspalma tomaspalma commented Aug 7, 2024

This pr improves course class fetching.

  • It creates a new checkboxedCourses state separated from the pickedCoursesone. This way, when a user selects a course it goes into the checkboxedCourses list and then we have an useEffect that upon update of the checkboxedCourses, it fetches the classes and updates picked courses

  • Switch class fetching to useSwr and add shimmer effect while loading

  • It also fixes a bug where if we selected all of the classes of a year, the picked class ids of already chosen classes was being removed 😢

@tomaspalma tomaspalma self-assigned this Aug 7, 2024
@tomaspalma tomaspalma changed the title refactor: improved class fetching logic by separating states Improved class fetching logic by separating states Aug 7, 2024
Copy link

netlify bot commented Aug 7, 2024

Deploy Preview for tts-fe-preview ready!

Name Link
🔨 Latest commit 4083218
🔍 Latest deploy log https://app.netlify.com/sites/tts-fe-preview/deploys/66b5401d5b67680008e61e6c
😎 Deploy Preview https://deploy-preview-238--tts-fe-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@tomaspalma tomaspalma marked this pull request as draft August 7, 2024 16:09
@tomaspalma tomaspalma force-pushed the refactor/improve-course-class-fetching branch from 286078e to 1dc20f8 Compare August 8, 2024 00:36
@tomaspalma tomaspalma marked this pull request as ready for review August 8, 2024 00:50
@tomaspalma tomaspalma requested a review from a team August 8, 2024 00:50
@thePeras
Copy link
Member

thePeras commented Aug 8, 2024

  • Include a promise.all when fetching the data, so this way they don't wait for each other
  • Make sure to not fetch the already fetched courses again

Copy link
Member

@thePeras thePeras left a comment

Choose a reason for hiding this comment

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

✅ 🛫

@tomaspalma tomaspalma merged commit d206c85 into develop Aug 9, 2024
4 checks passed
@thePeras thePeras deleted the refactor/improve-course-class-fetching branch August 9, 2024 12:21
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