Skip to content

Conversation

@Nokondi
Copy link
Contributor

@Nokondi Nokondi commented May 12, 2025

This update fixes a couple of issues with the co-teacher notification on the new teacher homepage and adds a spinner while sections are loading asynchronously.

  • Moves the co-teacher notification to the section list so that it only displays viewing unarchived courses
  • Updates the setSections method in teacherSectionsRedux to prevent the error SET_SECTIONS called multiple times in a way that would remove data from appearing when reloading data on the new teacher homepage. This was preventing async loading and was also preventing the section list from updating unless the page was fully refreshed.
Recording.2025-05-14.100618.mp4

Links

TEACH-1849
TEACH-1683
TEACH-1851

Testing story

Added a new unit test for the spinner and updated other unit tests to account for the async loading.

Deployment strategy

Follow-up work

Privacy

Security

Caching

PR Checklist:

  • Tests provide adequate coverage
  • Privacy and Security impacts have been assessed
  • Code is well-commented
  • New features are translatable or updates will not break translations
  • Relevant documentation has been added or updated
  • User impact is well-understood and desirable
  • Pull Request is labeled appropriately
  • Follow-up work items (including potential tech debt) are tracked and linked

@Nokondi Nokondi marked this pull request as ready for review May 14, 2025 19:01
@Nokondi Nokondi requested a review from lfryemason May 14, 2025 19:01
);

// Update sectionsLoading state when asyncLoadComplete changes
React.useEffect(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need to use the state and a useEffect here instead of just using the redux value from asyncLoadComplete?

section[key as keyof Section] === undefined &&
prevSection[key as keyof Section] !== undefined
prevSection[key as keyof Section] !== undefined &&
!window.location.pathname.includes('/teacher_dashboard/home')
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't love basing logic on the URL. If there's another solution using props or arguments, I think that would be much more resilient, but understand if this is by far the easiest way.

@Nokondi Nokondi requested a review from lfryemason May 15, 2025 16:19
await screen.findByText(i18n.deleteSection());
const deleteModalButton = screen.getByLabelText(i18n.delete());
fireEvent.click(deleteModalButton);
await act(async () => fireEvent.click(deleteModalButton));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This fixes an error that was popping up during the test due to an async update happening during this event.

coteacherInvite,
coteacherInviteForPl,
// This prop is used to allow asyncLoadSectionData to be run in a way that might remove data
destructiveLoad = false,
Copy link
Contributor

Choose a reason for hiding this comment

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

Fantastic! I also love the name that you went with

@Nokondi Nokondi merged commit 26a09b3 into staging May 15, 2025
6 checks passed
@Nokondi Nokondi deleted the make-new-section-appear-in-list-after-accepting-coteacher-invite branch May 15, 2025 18:24
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