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

Move RazorPageGenerator SelectLists from GET handler to OnPageHandlerExecutionAsync #1005

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

AtOMiCNebula
Copy link

SelectList initializers are only being code-generated into the GET handlers, but not the POST handlers. Since .ViewData entries do not persist across responses, the page will not render correctly when the POST handler does not redirect (i.e. because validation failed).

This change moves the initialization into a shared OnPageHandlerExecutionAsync, which is invoked after model binding but before the handler itself. No need to dual-generate the initializers into both handlers!

`SelectList` initializers are only being code-generated into the GET
handlers, but not the POST handlers.  Since `.ViewData` entries do not
persist across responses, the page will not render correctly when the
POST handler does not redirect (i.e. because validation failed).

This change moves the initialization into a reusable
`OnPageHandlerExecutionAsync`, which is invoked after model binding but
before the handler itself.  No need to dual-generate the initializers
into both handlers!
@seancpeters
Copy link
Contributor

@danroth27 @mkArtakMSFT - this is content fixes for the razor page scaffolding generated content.

@AtOMiCNebula
Copy link
Author

FYI I've been unable to run the E2E_Test.RazorPageScaffolderTests collection of tests locally, and the ones I expect would consume my updated reference .txts appear to be being skipped in the Pipelines that get kicked off. I believe the .txts are correct, but still would like the chance to actually get the tests to pass before completing this.

Alternatively, I'll get the .nupkg installed locally and test the template generation by hand. Still hoping to get the tests themselves working first...I have an email going with Sean who suggested some things for me to try to get the local tests unblocked.

Base automatically changed from master to main February 3, 2021 20:43
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.

2 participants