-
Notifications
You must be signed in to change notification settings - Fork 8
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
Blazor Hybrid example app #1216
Merged
Merged
Conversation
This file contains 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
jattasNI
requested changes
May 1, 2023
rajsite
reviewed
May 1, 2023
packages/nimble-blazor/NimbleBlazor/wwwroot/NimbleBlazor.lib.module.js
Outdated
Show resolved
Hide resolved
rajsite
reviewed
May 1, 2023
packages/nimble-blazor/NimbleBlazor/wwwroot/NimbleBlazor.lib.module.js
Outdated
Show resolved
Hide resolved
rajsite
reviewed
May 1, 2023
packages/nimble-blazor/NimbleBlazor/wwwroot/NimbleBlazor.lib.module.js
Outdated
Show resolved
Hide resolved
rajsite
reviewed
May 1, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
discussions on strictness goals
rajsite
approved these changes
May 1, 2023
packages/nimble-blazor/NimbleBlazor/wwwroot/NimbleBlazor.lib.module.js
Outdated
Show resolved
Hide resolved
msmithNI
approved these changes
May 1, 2023
jattasNI
approved these changes
May 2, 2023
Co-authored-by: Jesse Attas <jattasNI@users.noreply.github.com>
… blazor-hybrid-fix
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.
Pull Request
🤨 Rationale
👩💻 Implementation
Introducing a Blazor Hybrid example app, which requires us to use a workaround for the existing ASP.NET Core issue that results in the JS Initialization code not running.
Workaround
Instead of relying on the JS initialization code to run (via the
afterStarted
method that Blazor knows to call via its JS Initializer API), we will just document a workaround that requires Blazor Hybrid apps to specifically include the script that will perform the necessary event registration hooks with theBlazor
object.This script is created from the existing (now modified)
NimbleBlazor.lib.module.js
file, which essentially removes theafterStarted
function wrapper around the event registration calls. If theBlazor
object is not available at the time we attempt to perform the event registrations, we will throw (I have yet to see a case where this happens).Additionally, we have put in guards in the script such that if/when the issue in ASP.NET Core is addressed (that is the cause for this workaround), then the event registration will not run multiple times.
🧪 Testing
The Blazor Hybrid example app loads the shared ComponentsPage seemingly without issue. Additionally, when adding the new workaround script to the script section of the
Demo.Server
project (to emulate what should happen when the ASP.NET Core issue is fixed for a Blazor Hybrid project) I saw no issues (i.e. errors/warnings reported in the console).✅ Checklist