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 Web Component Blazor POC #15647

Closed
wants to merge 5 commits into from
Closed

Blazor Web Component Blazor POC #15647

wants to merge 5 commits into from

Conversation

Skrypt
Copy link
Contributor

@Skrypt Skrypt commented Apr 2, 2024

@ns8482e Just creating a draft PR here as it is easier for me to review.

Related discussion: #15653

- Options Editor  and ModalDialog in Blazor
- Using blazor in PredefinedList
Copy link
Contributor

github-actions bot commented Apr 2, 2024

This pull request has merge conflicts. Please resolve those before requesting a review.

@Skrypt Skrypt changed the title Blazor POC Blazor Web Component Blazor POC Apr 2, 2024
@Skrypt Skrypt requested a review from sebastienros April 2, 2024 23:08
@Skrypt
Copy link
Contributor Author

Skrypt commented Apr 2, 2024

@sebastienros Here is one that is interesting to review. Looks like an interesting way to use Blazor. Need to analyze if it's better over an actual Vue app.

@Skrypt
Copy link
Contributor Author

Skrypt commented Apr 3, 2024

Just comparing the amount of code necessary for this with the Vue app.

https://github.com/OrchardCMS/OrchardCore/blob/main/src/OrchardCore.Modules/OrchardCore.ContentFields/Assets/js/OptionsEditor/optionsEditor.js

Here we have a 91 lines of code to achieve this vs all this code for Blazor to create the same thing. Blazor will require a lot more code management.

@giannik
Copy link
Contributor

giannik commented Apr 3, 2024

personally i would favor vanilla javascript and .net code over vue.js even if ir means more lines of code.

@Skrypt
Copy link
Contributor Author

Skrypt commented Apr 3, 2024

What is .NET code these days? Typescript with Vue.js or anything else is C# syntax like too ... I need to take a deeper look later on and review this PR more.

@@ -0,0 +1,10 @@
export function optionsChanged(element, jsonValue, defaultValue) {
Copy link
Contributor Author

@Skrypt Skrypt Apr 3, 2024

Choose a reason for hiding this comment

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

Could this be renamed to .mjs so that we make a distinction between plain javascript and modules?
Also, need to understand why we need this javascript if we are using Blazor.
It throws an event to Blazor basically but why?

Copy link
Contributor

@ns8482e ns8482e Apr 3, 2024

Choose a reason for hiding this comment

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

To trigger the event to DOM, so it can be handled from any handler that can listen to such events

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I understand that part. Can't these events be handled by Blazor? Seems like it can by doing a quick Google search.

Copy link
Contributor Author

@Skrypt Skrypt Apr 3, 2024

Choose a reason for hiding this comment

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

Something like <input @onchange=SetMessage>

Copy link
Contributor Author

@Skrypt Skrypt Apr 3, 2024

Choose a reason for hiding this comment

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

This file using @export suggests that it will be treated as an ECMAScript module.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And that probably means that we would need to convert every small scripts to ES6 modules.

</div>
<script at="Foot">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We really need to have a bundler to start having script type="module" and get rid of these template scripts.

if (JS is not null)
{
JSModule = await JS.InvokeAsync<IJSObjectReference>("import",
$"./_content/{ns}/{cmp}.razor.js");
Copy link
Contributor Author

@Skrypt Skrypt Apr 3, 2024

Choose a reason for hiding this comment

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

Here the ES6 module are imported based on their name. This should be renamed to .mjs to make a distinction or support it at least.

# Conflicts:
#	OrchardCore.sln
#	src/OrchardCore.Modules/OrchardCore.Admin/Startup.cs
Copy link
Contributor

This pull request has merge conflicts. Please resolve those before requesting a review.

Copy link
Contributor

It seems that this pull request didn't really move for quite a while. Is this something you'd like to revisit any time soon or should we close? Please comment if you'd like to pick it up.

@github-actions github-actions bot added the stale label Jun 16, 2024
Copy link
Contributor

github-actions bot commented Jul 2, 2024

Closing this pull request because it has been stale for very long. If you think this is still relevant, feel free to reopen it.

@github-actions github-actions bot closed this Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants