Skip to content

Improved Object Validations with New ValidateObject #13232

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

Merged

Conversation

Abhishek-Punhani
Copy link
Contributor

@Abhishek-Punhani Abhishek-Punhani commented Mar 19, 2025

Implemented improved object validations using validateObject function

  • Replaced ad-hoc validation logic with validateObject function for consistency and maintainability
  • Updated prop validation in components to use validateObject
  • Ensure all object prop validations are thorough and standardized
  • Manual verification performed to ensure no regressions

Issue Addressed : #8903

Reviewer Guidance

We have implemented improved object validations using the validateObject function. This change replaces ad-hoc validation logic with validateObject for consistency and maintainability. We have updated prop validation in components to use validateObject and ensured all object prop validations are thorough and standardized. Manual verification has been performed to ensure no regressions.

Please review the following pages/components for potential issues due to recent changes:

Pages/components using ChannelCardGroupGrid

How to Preview:

1: Home Page:

  • Navigate to the home page of the application.
  • Verify that the channel cards are displayed correctly in a grid layout.
  • Ensure that the titles, thumbnails, and descriptions of the channels are rendered correctly.
  • Check that clicking on a channel card navigates to the correct channel page.
  • Focus: Ensure no validation errors appear in the console.

2. Explore Page:

  • Navigate to the explore page where different channels are listed.
  • Verify that the channel cards are displayed correctly in a grid layout.
  • Ensure that the titles, thumbnails, and descriptions of the channels are rendered correctly.
  • Check that clicking on a channel card navigates to the correct channel page.
  • Focus: Ensure no validation errors appear in the console.

Pages/components using CopiesModal

How to Preview:

1. Resource Details Page:

  • Navigate to a resource details page where a resource has multiple copies.
  • Click on the "Locations" link to open the CopiesModal.
  • Verify that the modal displays the list of copies correctly.
  • Ensure that the titles and ancestors of the copies are rendered correctly.
  • Check that clicking on a copy title navigates to the correct resource location.
  • Focus: Ensure no validation errors appear in the console.

2. Search Results Page:

  • Perform a search that returns resources with multiple copies.
  • Click on the "Locations" link for a resource to open the CopiesModal.
  • Verify that the modal displays the list of copies correctly.
  • Ensure that the titles and ancestors of the copies are rendered correctly.
  • Check that clicking on a copy title navigates to the correct resource location.
  • Focus: Ensure no validation errors appear in the console.

Pages/components using AlsoInThis

How to Preview:

1.Resource Details Page:

  • Navigate to a resource details page.
  • Scroll down to the "Also in this" section.
  • Verify that the related resources are displayed correctly.
  • Ensure that the progress bars, icons, and titles of the related resources are rendered correctly.
  • Check that clicking on a related resource navigates to the correct resource page.
  • Focus: Ensure no validation errors appear in the console.

2 .Topic Page:

  • Navigate to a topic page where resources are listed.
  • Scroll down to the "Also in this" section.
  • Verify that the related resources are displayed correctly.
  • Ensure that the progress bars, icons, and titles of the related resources are rendered correctly.
  • Check that clicking on a related resource navigates to the correct resource page.
  • Focus: Ensure no validation errors appear in the console.

Please ensure that the data validation, rendering, and interactions are working as expected. If you encounter any issues, please report them for further investigation.

@github-actions github-actions bot added APP: Learn Re: Learn App (content, quizzes, lessons, etc.) DEV: frontend labels Mar 19, 2025
Copy link
Member

@nucleogenesis nucleogenesis left a comment

Choose a reason for hiding this comment

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

I spun it up locally and saw no issues - notably I saw no errors in the console, so the validator objects seem to match what is expected in each component.

Thank you for this! I really appreciate having defined types in components like this to make it clear what needs to be passed around.

@MisRob
Copy link
Member

MisRob commented Mar 20, 2025

Thanks a lot @nucleogenesis.

@Abhishek-Punhani would you please update

Pages/components using ChannelCardGroupGrid
Pages/components using CopiesModal
Pages/components using AlsoInThis

with the guidance on how to preview those pages from a user point of view? Our QA team doesn't examine code. I will then loop them in to make final confirmation before we merge. I think it should be fine as @nucleogenesis have checked on it, but we're shortly before a release and in the previous PR were running into some unexpected issues, so I'd like to have their thumbs up.

@MisRob MisRob assigned radinamatic and unassigned radinamatic Mar 20, 2025
@MisRob MisRob requested review from radinamatic and pcenov March 20, 2025 16:27
@radinamatic
Copy link
Member

Yes, please, add some comprehensive review guidance for testing of the potential user-facing consequences of the changes in this PR 🙏🏽

@MisRob
Copy link
Member

MisRob commented Mar 20, 2025

Thanks so much for the updated guidance @Abhishek-Punhani - I know this must be lots of work, and it's much appreciated. @radinamatic on these places, we want to focus on no validation errors in the console. I don't think it should break anything functional really, but changes like this have high potential to overwhelm console (and us fixing them shortly before the release :)

@radinamatic
Copy link
Member

Oh, I skimmed the first post and could not see the relevant heading...

@Abhishek-Punhani again, thank very much for the work on this contribution, but please, respect the PR template structure (do not just delete it, and write over), it's there for a reason. If need be separate the guidance for code review, and that for the manual QA, but the latter is best placed under the relevant heading in the template (see the example from another PR below):

reviewer-guidance

@Abhishek-Punhani
Copy link
Contributor Author

Abhishek-Punhani commented Mar 20, 2025

@radinamatic , apologies, but I didn't understand how to add reviewer guidance. Because we are just assigning all these props a type that won't affect any functionality, we need to ensure that there are no console errors due to these type assignments

@radinamatic
Copy link
Member

radinamatic commented Mar 20, 2025

Take it just as a recommendation for future PRs 🙂
Keep the template that is there when you open a new PR, and just fill in the content below the headings. If you by error remove the heading for the reviewer guidance, just add a new heading with that wording:

## Reviewer guidance
<!--
 * how can a reviewer test these changes?
 * are there any risky areas that deserve extra testing
-->

If there are no user-facing consequences, but you still would like a manual QA confirmation (when we use actual built assets, instead of running from the source), explain that clearly in the reviewer guidance 🙂

@Abhishek-Punhani
Copy link
Contributor Author

@radinamatic , I will take care of this from next PR

Copy link
Member

@pcenov pcenov left a comment

Choose a reason for hiding this comment

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

No issues observed while regression testing - LGTM!

@MisRob
Copy link
Member

MisRob commented Mar 21, 2025

Wonderful, thanks all of you here

@MisRob
Copy link
Member

MisRob commented Mar 21, 2025

We can merge after pending checks pass

@Abhishek-Punhani
Copy link
Contributor Author

Abhishek-Punhani commented Mar 24, 2025

I noticed that some checks are still pending. Do they require one remaining approval?

@MisRob MisRob self-assigned this Mar 25, 2025
@nucleogenesis
Copy link
Member

@Abhishek-Punhani - I think we may have had some issues with GH actions in the last week or so causing the stall.

Could you fetch and rebase on the latest develop branch, then push again? I suspect that this will let the checks run through as needed.

@MisRob
Copy link
Member

MisRob commented Apr 3, 2025

Thanks all. Good work @Abhishek-Punhani

@MisRob MisRob merged commit f52f8e7 into learningequality:develop Apr 3, 2025
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
APP: Learn Re: Learn App (content, quizzes, lessons, etc.) DEV: frontend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants