-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Enhance forms should isolate updates to their own DOM subtree or a specified element #61863
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
@Ali1Jamal thanks for contacting us.
Can you give us more details about when this is happening in your app/site? Are those components interactive components on the page? |
Thanks, @javiercn, for your response! Apologies for the typo — I meant enhanced forms, not enhanced navigation. When using Blazor SSR dotnet 9, if a page is marked with the [ExcludeFromInteractiveRouting] attribute this means happen only in static render mode not in interactive page, I’ll share a screen recording and the page component to provide more info about the problem.
video: Screen.Recording.2025-05-12.at.5.11.54.PM.mov |
@Ali1Jamal thanks for the additional details. You need to initialize The other aspect is that I do not think we will ever do a feature to "isolate" updates to some forms. I think this could be classified as either a "bug" because we should be preserving existing state for forms or a "feature" because preserving the state of other forms is not something that we can do at the framework level and requires the user to specify what behavior they want (we can't differentiate when the form has been reset from the server explicitly vs when no values were provided, so we might need on attribute to know which forms we should preserve the values from or reset. The model for enhanced nav works by updating the entire document, and having a model where it happens only in a subset can cause problematic situations, for example, a component doing that to a form could cause other parts of the page to not receive updates and make it really hard to troubleshoot the problem. |
Is there an existing issue for this?
Is your feature request related to a problem? Please describe the problem.
In Blazor SSR with enhanced navigation (Enhance on ), when a page has multiple components, submitting one form causes the entire page to re-render based on the parameters from [SupplyParameterFromForm]. This often results in:
• Other forms being reset unintentionally
• Unrelated components receiving unexpected updates or data loss
Describe the solution you'd like
Add an option to to limit the update scope to only the child DOM subtree of the submitted form or
another element.
Possible approach:
• A new parameter for EditForm like IsolatedEnhanceName="form1" to scope rendering to the form’s children or to scope to any element with attribute maybe like form-isolated-name="form1".
its will looks like this:
<EditForm Enhance IsolatedEnhanceName="form1" >
if there element with :
it will only update the child of this div , else it will update only child of that form.
Additional context
No response
The text was updated successfully, but these errors were encountered: