Skip to content

Blazor static SSR multiple forms and "transient" data #51162

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

Closed
jonhilt opened this issue Oct 5, 2023 · 1 comment
Closed

Blazor static SSR multiple forms and "transient" data #51162

jonhilt opened this issue Oct 5, 2023 · 1 comment
Labels
area-blazor Includes: Blazor, Razor Components

Comments

@jonhilt
Copy link

jonhilt commented Oct 5, 2023

ref: #49340 (comment)

I tried implementing a similar approach to this, with some data being loaded via an external API and ran into some unexpected behaviour.

Here's a minimal repro:
https://github.com/jonhilt/BlazorNet8Testing/blob/master/RTMTest/Components/Pages/Home.razor

In this example there's one form which enables the user to search some arbitrary data.

Then the results load and they are rendered inside another form, for the purposes of enabling interaction with each result (but still using forms and static SSR).

At the moment, when you click a button in the search results, the form is submitted, but I was hoping the search results would remain present on the screen.

As it is, they disappear as soon as you try to interact with any of the items.

(this is with data-enhance enabled).

ssrsearch

dotnet: 8.0.100-rtm.23503.6

Originally posted by @jonhilt in #49340 (comment)

@ghost ghost added the area-blazor Includes: Blazor, Razor Components label Oct 5, 2023
@jonhilt
Copy link
Author

jonhilt commented Oct 5, 2023

OK, now I've written that out and thought about it I realise the answer is presumably to execute the search in OnInitialized to ensure the results are still rendered on the page following the form post.

I guess my thought was that data-enhance might preserve the existing DOM but it makes sense that it wouldn't (I think :))

@jonhilt jonhilt closed this as completed Oct 5, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Nov 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components
Projects
None yet
Development

No branches or pull requests

1 participant