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

Migrate Blazor components to ComponentBase style ViewModels #72

Open
csharpfritz opened this issue Aug 11, 2019 · 6 comments
Open

Migrate Blazor components to ComponentBase style ViewModels #72

csharpfritz opened this issue Aug 11, 2019 · 6 comments
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@csharpfritz
Copy link
Contributor

DayPickerViewModel is a good example of using this technique

@csharpfritz csharpfritz added enhancement New feature or request help wanted Extra attention is needed labels Aug 11, 2019
@SimonGeering
Copy link
Contributor

@csharpfritz I can have a crack at this if you like?

@csharpfritz
Copy link
Contributor Author

Assigned to you @SimonGeering

@SimonGeering
Copy link
Contributor

@csharpfritz As it stands the dev branch gives the following error if you pull a clean fork, run the restoreDb.cmd and register a user:

WASM: Unhandled exception rendering component:
WASM: System.NullReferenceException: Object reference not set to an instance of an object.
WASM:   at Fritz.ResourceManagement.WebClient.Pages.DayView.<OnInit>b__20_0 (System.Object o, Fritz.ResourceManagement.WebClient.Data.ScheduleState+SelectedDateChangedArgs args) <0x2490510 + 0x0005a> in <97b570a6db5944e68f9c37c0d3aaea0f>:0 
WASM:   at (wrapper delegate-invoke) System.EventHandler`1[Fritz.ResourceManagement.WebClient.Data.ScheduleState+SelectedDateChangedArgs].invoke_void_object_TEventArgs(object,Fritz.ResourceManagement.WebClient.Data.ScheduleState/SelectedDateChangedArgs)
WASM:   at Fritz.ResourceManagement.WebClient.Data.ScheduleState.SelectDate (System.DateTime newDate) <0x248ff90 + 0x0007e> in <97b570a6db5944e68f9c37c0d3aaea0f>:0 
WASM:   at Fritz.ResourceManagement.WebClient.ViewModels.AvailabilityViewModel.OnInitAsync (System.Security.Claims.ClaimsPrincipal user) <0x2363920 + 0x001f0> in <97b570a6db5944e68f9c37c0d3aaea0f>:0 
WASM:   at Fritz.ResourceManagement.WebClient.Pages.Availability.OnInitAsync () <0x2362b48 + 0x00246> in <97b570a6db5944e68f9c37c0d3aaea0f>:0 
WASM:   at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync () <0x1ebe718 + 0x00182> in <b9c0a2e1f675400685e6d6841f63a5eb>:0 
WASM:   at Microsoft.AspNetCore.Components.Rendering.Renderer.GetErrorHandledTask (System.Threading.Tasks.Task taskToHandle) <0x21000c0 + 0x00100> in <b9c0a2e1f675400685e6d6841f63a5eb>:0 

I could either:
A) Continue with this refactoring without the ability to run and dev test this, relying on the compiler mainly since the unit tests don't have the coverage needed in the UI layer to be of much reassurance.
This may need some considerable TLC on merging the PR, as was the case when we did the merge of the initial ViewModel changes without being able to dev test!

B) Wait for you to fix the above bug and/or improve the "I'm a new contributor experience" when first doing a GitClone of a fork - further to my points in #42 so the app runs and a test account can be logged into based on some instructions in readme.md

Let me know which way you would like to proceed, please.

@SimonGeering
Copy link
Contributor

Additionally in terms of solution structure and layout - would we want to remove the ViewModel folder and instead move to a more functional file structure by adding, for each razor file, a corresponding xxx.Component.cs file in the Pages folder?

This would help group code by functional area in one place, similar to the Angular feature-based naming structure

@GoranHalvarsson
Copy link
Contributor

@SimonGeering try to do a ef migration. It should fix your error

@SimonGeering
Copy link
Contributor

It looks like the fixes that were added on stream for the preview 8 update will un-block this. I will pick it up after that is PR to the main repo

csharpfritz added a commit that referenced this issue Aug 20, 2019
As agreed in #72 this PR will switch all view models to inherit ComponentBase
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants