blazor-workshop icon indicating copy to clipboard operation
blazor-workshop copied to clipboard

Placing order in lesson 2 will not work when following guide.

Open 17steen opened this issue 3 years ago • 12 comments

save point 2 Address.cs, in this file, required fields are defined. Those do not get filled up at any point by the Client, but the server will expect them, when the order is placed, to be filled in. This however never gets mentioned, and the tutorial goes on to lesson 3, which will then never work because the orders do not get added to the database. It gets very confusing as you then think to start from the following save point, and now it magically works. This is the result of those constraints to now be commented, without it being shown in the tutorial. This lead the learner to have a considerably lengthy headache not understanding what they did wrong. save point 3 Address.cs

17steen avatar May 18 '22 16:05 17steen

Same issue. Tutorial says that if I click on Track link button next to the order it will go to my orders/

Only problem is that I never get to have any orders as they never get to the back-end. It's very confusing.

catalincodes avatar May 26 '22 17:05 catalincodes

@catalinp86 I haven't seen this issue. Mine works just fine. Could you share your repo?

dotnetspark avatar May 26 '22 17:05 dotnetspark

@17steen true that save-point sections -even 1st- have the required attributes. That should be fixed so it matches the docs. However, I would encourage to follow the tutorial while save-points is fixed.

dotnetspark avatar May 26 '22 17:05 dotnetspark

I will try again, a 3rd time, this time on another machine and see if I reproduce it again (initially, it was on the work computer, so no github). This time, I'll clone it on my machine, take the state at end of the session 2, place it in a public github repo and add the first steps in session 3. If the problem is still there I will push the changes and leave it as is.

catalincodes avatar May 26 '22 23:05 catalincodes

@catalinp86 I haven't seen this issue. Mine works just fine. Could you share your repo?

@ylr-research I have repeated once again, the same process:

  1. Taken the source code from 02-customize-a-pizza
  2. Added the MyOrders part from 03 Show Order Status
  3. Run the application once I've added the Rendering of the list of orders
  4. Observed that I can place an order, but no orders are displayed in the MyOrders page

It adds up, because after submitting the pizza order, when I enter the MyOrders page, when the HttpClient attempts to get the list of Pizza orders it comes back with an empty list. That's abnormal.

catalincodes avatar May 27 '22 00:05 catalincodes

image

This is the state on the server-side of orders.

PS: I apologize @ylr-research , if the repo isn't perfectly clean (source-code only), but I was on a little time, but I wanted to get back to you, since I need to get better at it for work and I was recommended this tutorial.

catalincodes avatar May 27 '22 00:05 catalincodes

I met same problem, and somehow magically it solved by itself. Firstly, I commented Address.cs as in 3rd save point and began to compare code lines of 3rd and then 2nd save points in debug mode. Breakpoints was chosen to check orders variables (as @catalinp86 mentioned), and I didn't find any obvious differences, BUT in debug mode the 2nd save point surprisely start working as expected in tutorial. It's worth noting, that I launched debugging during whole day, but issue was resolved only after put breakpoints and checking lines step by step. Strange bug.

DjinnYcs avatar Jun 05 '22 21:06 DjinnYcs

Anyone still struggling, the solution would be to comment out model validation attributes in BlazingPizza.Shared.Address.cs and re-create the database (just delete pizza.db and re-start the app).

rzmz avatar Jun 15 '22 08:06 rzmz

I'll test that out @rzmz

catalincodes avatar Jun 18 '22 22:06 catalincodes

Thanks very much for this @17steen and @rzmz. I experienced the same issue as @catalinp86 . Commenting out model validation attributes didn't work initially but as you said re-creating the database got it all working again. Much appreciated.

neintoes avatar Jun 26 '22 23:06 neintoes

Yes, I think we need to roll-back the initial requirements attributes in Address.cs as a recommended fix to this

csharpfritz avatar Jul 22 '22 15:07 csharpfritz

Just wanted to add I only created a new PR because I couldn't figure out how to contribute to the existing one that's 27 days old and is missing changes to save-points 01 and 02.

Gobbenobber avatar Aug 30 '22 11:08 Gobbenobber