Skip to content

handle null values coming back on feature_img_src from mitxonline#3015

Open
gumaerc wants to merge 1 commit intomainfrom
cg/handle-null-feature-img-src-mitxonline
Open

handle null values coming back on feature_img_src from mitxonline#3015
gumaerc wants to merge 1 commit intomainfrom
cg/handle-null-feature-img-src-mitxonline

Conversation

@gumaerc
Copy link
Contributor

@gumaerc gumaerc commented Mar 4, 2026

What are the relevant tickets?

Pre-requisite for https://github.com/mitodl/hq/issues/10433

Description (What does it do?)

This PR sets up uses of feature_img_src on Wagtail pages coming back from the MITx Online API to handle the value being null. Currently, this field is not nullable, but when mitodl/mitxonline#3351 merges, it will be. If the field is null, DEFAULT_RESOURCE_IMG is used.

How can this be tested?

  • Make sure you have an instance of MITx Online setup and linked to your instance of MIT Learn
  • Your instance of MIT Learn should have Posthog configured and the mitxonline-product-pages feature flag enabled
  • Your instance of MITx Online should be on the cg/null-course-image branch
  • In MITx Online, you should have both a course and a program with Wagtail pages, but their featured image should not be set
  • Visit the course and program pages for your test course and program:
    • /courses/course-readable-id
    • /programs/program-readable-id
  • Verify that you see Learn's default resource image being used

Checklist:

  • After this PR and correct default course / program image behavior mitxonline#3351 are released, a follow-up PR will need to be created to upgrade the @mitodl/mitxonline-api-axios package and strip out some of the test logic that was necessary in this PR because the field is not nullable yet. The mit-dome.png image that is unused by Learn itself should also be removed.

Copy link
Contributor

@ChristopherChudzicki ChristopherChudzicki left a comment

Choose a reason for hiding this comment

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

We shouldn't merge this till the mitxonline one is merged, right?

I tried this branch with the updated client. It has a bunch of TS errors, but they are mostly to do with mitodl/mitxonline#3326.

There were a few errors because instructor.feature_image_src is now nullable ... I guess it was defaulting to the course image before.

@gumaerc
Copy link
Contributor Author

gumaerc commented Mar 5, 2026

We shouldn't merge this till the mitxonline one is merged, right?

I tried this branch with the updated client. It has a bunch of TS errors, but they are mostly to do with mitodl/mitxonline#3326.

There were a few errors because instructor.feature_image_src is now nullable ... I guess it was defaulting to the course image before.

Hm, this is a good point. I had thought we would want to merge this first, because if we merge and release the MITx Online PR first then it will start delivering nulls that Learn is not currently set up to deal with. Even if you're using the old version of the API client, null will still come back in the data which will cause errors? Although, now that I think about it that might be okay temporarily seeing as everything is still feature flagged?

@ChristopherChudzicki
Copy link
Contributor

no you're right, we should merge this first!

@gumaerc
Copy link
Contributor Author

gumaerc commented Mar 5, 2026

no you're right, we should merge this first!

I'll be putting a follow-up to this up after the MITx Online release to update the API client version and remove the unnecessary code in the tests that handles the fact that the API current says the field is non-nullable.

@gumaerc gumaerc force-pushed the cg/handle-null-feature-img-src-mitxonline branch 2 times, most recently from 6dafac6 to b274a7a Compare March 8, 2026 23:40
@gumaerc gumaerc force-pushed the cg/handle-null-feature-img-src-mitxonline branch from b274a7a to 7b6d240 Compare March 8, 2026 23:40
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