Skip to content
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 17 commits into from
May 2, 2023
Merged

Blazor Hybrid example app #1216

merged 17 commits into from
May 2, 2023

Conversation

atmgrifter00
Copy link
Contributor

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 the Blazor object.

This script is created from the existing (now modified) NimbleBlazor.lib.module.js file, which essentially removes the afterStarted function wrapper around the event registration calls. If the Blazor 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

  • I have updated the project documentation to reflect my changes or determined no changes are needed.

@atmgrifter00 atmgrifter00 requested a review from rajsite May 1, 2023 16:04
@atmgrifter00 atmgrifter00 linked an issue May 1, 2023 that may be closed by this pull request
Copy link
Member

@rajsite rajsite left a 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

@jattasNI jattasNI self-requested a review May 1, 2023 18:07
@atmgrifter00 atmgrifter00 requested a review from rajsite May 1, 2023 20:56
packages/nimble-blazor/README.md Outdated Show resolved Hide resolved
atmgrifter00 and others added 3 commits May 2, 2023 09:30
@atmgrifter00 atmgrifter00 enabled auto-merge (squash) May 2, 2023 14:36
@atmgrifter00 atmgrifter00 merged commit da1d0f2 into main May 2, 2023
@atmgrifter00 atmgrifter00 deleted the blazor-hybrid-fix branch May 2, 2023 14:51
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.

Some controls don't work in BlazorWebView on Windows
4 participants