Repository navigation
Conversation
…text The wizard's step-1 inputs were drilled three or four levels (AddResourceWizard -> ResourceUploadStep -> PassageRecordPanel -> leaves). AddResourceWizard now provides them through ResourceUploadContext; the step and its record panel read the context, and only the shared leaves (MediaUploadContent, MediaRecord) still take explicit props. PassageRecordPanel is wizard-only, so it moves next to the wizard as ResourceRecordPanel. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Note
Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.
🟢 Approval recommended
The refactor is accompanied by updated and expanded Jest coverage—including provider-wrapped renders and an explicit outside-provider error test—indicating the new context-based data flow is exercised with no outstanding concerns noted.
No open issues 🎉
What changed in this PR
Refactors the add-resource wizard’s step-1 (Upload/Record) data flow to eliminate deep prop drilling by introducing a step-scoped ResourceUploadContext, keeping behavior intended to remain the same.
Changes:
- Adds
ResourceUploadContextand updates step-1 components to consume shared inputs via context instead of threaded props. - Renames/moves the record panel to
ResourceRecordPanelunderInternalization/, passing only step-owned upload controls explicitly. - Updates Jest tests to wrap renders in the provider and validate the hook throws when used outside the provider.
| File | Description |
|---|---|
| web/src/components/PassageDetail/Internalization/ResourceUploadStep.tsx | Updates the upload step to read required inputs from ResourceUploadContext and simplifies its public props surface. |
| web/src/components/PassageDetail/Internalization/ResourceUploadStep.test.tsx | Adjusts step tests to render within the new context provider and adds coverage for the outside-provider error case. |
| web/src/components/PassageDetail/Internalization/ResourceUploadContext.tsx | Introduces ResourceUploadContext and a useResourceUploadContext() hook that enforces provider presence. |
| web/src/components/PassageDetail/Internalization/ResourceRecordPanel.tsx | Adds the wizard-scoped ResourceRecordPanel that consumes upload/record inputs from context and accepts only the step-owned upload method and finish handler. |
| web/src/components/PassageDetail/Internalization/AddResourceWizard.tsx | Wraps step 1 with the new context provider and removes previously drilled props by supplying them through the provider value. |
| web/src/components/PassageDetail/Internalization/AddResourceWizard.test.tsx | Updates wizard tests so the mocked step reads its inputs from ResourceUploadContext rather than receiving them as props. |
| web/src/components/MediaRecord.tsx | Updates an internal reference/comment to align with the ResourceRecordPanel rename. |
Review effort: Balanced
Addresses Devin review on #875: the jest mock now sets displayName (jest testing takeaways) and uses jest.requireActual<T>() instead of an `as` cast (CODING_STANDARDS Types). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
nabalone
marked this pull request as ready for review
November 13, 2026 16:12
2 of 3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #868 (
upload-prop-renames). Retarget todeveloponce #868 merges.What changed
Follow-up to the prop audit of the add-resource wizard. The step-1 inputs were drilled 3–4 levels deep (
AddResourceWizard→ResourceUploadStep→PassageRecordPanel→MediaUploadContent/MediaRecord/SpeakerName).ResourceUploadContext(PassageDetail/Internalization/ResourceUploadContext.tsx), provided byAddResourceWizardaround step 1 only.useResourceUploadContext()throws outside the provider.ResourceUploadSteptakes no props; reads the context. Passes only its ownuploadMethod(itsuseMediaUploadinstance) and thecancelled-settingfinishwrapper to the record panel.PassageRecordPanel→ResourceRecordPanel, moved intoInternalization/since its only caller is the wizard. TakesuploadMethod+finish; reads the rest from context.MediaUploadContent,MediaRecord) keep explicit props.artifactId ?? VernacularTag—VernacularTagisnull, so it was a no-op (the hook already yields?? null).Test plan
npm run typecheckResourceUploadStep.test.tsx(now renders inside the provider; adds a throws-outside-provider case),AddResourceWizard.test.tsx(mock step reads the context)🤖 Generated with Claude Code