-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Enhancements to components #5455
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
Comments
Core app model features underway:
Under consideration:
|
Hi, I don't really like how the component initialization and state management works now. In short - it seems to be too much reflection based. Do you consider redesigning it anyway? Sometimes it seems almost ironic that you have a comment "we could consider removing the 'name equality' check entirely for perf" just before assigning the property by reflection :) IMO, it would be nicer to have a "component descriptor" that would be able to create a new instance and to update an existing instance (and say if it has been updated) and that would be generated by the Razor compiler. Something like: private SomeType lastValue_component1_attribute1;
private Descriptor component1 = new Descriptor<MyComponent>(
create: () => {
return new MyComponent() {
SomeHardcodedAttr = "123"
}
},
update: (component) => {
bool updated = false;
var atribute1 = this.Property123; // just get value from closure
if (attribute1 == lastValue_component1_attribute1) { // no virtual dispatch for comparison
component.Attribute1 = lastValue_component1_attribute1 = attribute1;
updated = true;
}
return updated;
}
);
void Build(... builder) {
builder.AddComponent(1, component1);
} This approach would be much more extensible for alternative component state management approaches. I'm also pretty sure that it would be more performant. While the code might look significantly longer in C#, I'm pretty sure that the difference will not be that dramatic when compiled to MSIL or WASM, and it will also give LLVM much more room for optimizations. Of course, you could leave the current mechanism as a sugar above this mechanism, noone says that the |
@danroth27 This is done enough for 0.0.5 so I'm moving it to 0.1.0 now for the remaining items. |
Is “Controlling whether a parameter is required” the same as “Allowing optional parameters” ? (e.g. @page(“user/{name}/{id}?”)) If so, then I don’t have to open a new enhancement issue. |
@AxDSan in Blazor i don't think it supports the optional parameter yet... i tried to have an optional indicator "?" but got the below error
the way to do this, is to have multiple route definition in the page. For e.g. in my case i wanted "/feed/{FeedId}". the FeedId can be empty. so to handle this situation you will need to have the following route defined in the page
hope this helps |
Yup that's a workaround :D thank you! |
Can someone explain in a few words what is: "Controlling whether arbitrary non-declared parameters can be passed". Why should we have this possibility? What are the benefits? |
@Andrzej-W Currently, although component A written in Razor can declare parameters via |
Quick question, I'm looking through the list of features, but do we have that one thing that allows components to output data back to the parent component? something like Angular maybe like the |
Thank you @SteveSandersonMS for explanation. |
Moving out of the preview3 milestone because nothing specific in this issue is planned for preview 3. |
I've moved the "key" item to a new issue at #8232 And as for what remains besides that, it's more a list of mostly-outdated ideas than things we're committed to. We can create new issues for anything that still comes up as a requirement. A moment of contemplation, if you will, as we finally close what was the original issue 1 at https://github.com/aspnet/blazor/issues/1. |
|
No description provided.
The text was updated successfully, but these errors were encountered: