Conversation
Reviewer's GuideAdds two callback parameters to the PdfViewer component—OnLoaded for when a PDF finishes loading and NotSupportCallback when the viewer is unsupported—by extending the C# component with new parameters and JSInvokable methods, updating the interop initialization to pass callback identifiers, and enhancing the JavaScript module to invoke these callbacks at the appropriate times. Sequence Diagram for OnLoaded CallbacksequenceDiagram
title Sequence Diagram for OnLoaded Callback
participant UserCode as Consuming Code
participant PdfViewerCS as PdfViewer.razor.cs
participant PdfViewerJS as PdfViewer.razor.js
participant Browser as Browser/PDF Engine
UserCode->>PdfViewerCS: Initialize PdfViewer with OnLoaded delegate
PdfViewerCS->>PdfViewerJS: InvokeInitAsync(Id, Interop, {LoadedCallaback: "TriggerOnLoaded", ...})
PdfViewerJS->>Browser: command: Load PDF (e.g., set iframe src)
Browser-->>PdfViewerJS: event: PDF loaded (e.g., iframe onload)
PdfViewerJS->>PdfViewerCS: invokeMethodAsync("TriggerOnLoaded")
PdfViewerCS->>PdfViewerCS: Execute TriggerOnLoaded()
alt OnLoaded delegate is provided
PdfViewerCS->>UserCode: Execute OnLoaded() Task
end
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey @ArgoZhang - I've reviewed your changes - here's some feedback:
- The JSON field “LoadedCallaback” is misspelled and doesn’t match the JS usage of loadedCallaback; correct it to loadedCallback (and update both sides) so your interop callback actually fires.
- Your JS checks for options.notSupportCallback (camelCase) but .NET is serializing NotSupportCallback (PascalCase); align the property names/casing between the C# JSON and JS to avoid undefined callbacks.
Here's what I looked at during the review
- 🟡 General issues: 5 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Member
Author
|
@sourcery-review |
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.
Link issues
fixes #451
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Add OnLoaded and NotSupportCallback parameters to PdfViewer component and wire JS interop to trigger these callbacks on document load and unsupported viewer scenarios
New Features: