Em-Ant / fcc-options-app

Options Inc. web app development
Other
12 stars 7 forks source link

Add a deleted consumer to vehicle on the map causes a perpetual loading state. #21

Closed andrealonzo closed 8 years ago

andrealonzo commented 8 years ago

Open 2 browsers. Browser 1: Go to consumers Browser 2: Go to Map Browser 1: Delete a consumer Browser 2: Add that consumer to a vehicle

This is related to #16. I wanted to give a specific example of this issue.

andrealonzo commented 8 years ago

This is fixed on the server with 4109c1a42ae6d1c13e0aa0010e4446ec983b11ff. The map marker still turns to green when you try to add a nonexistent consumer.

Em-Ant commented 8 years ago

09ee9a7 should fix marker colors. Is it possible to have a custom message on this kind of event (i.e. 'consumer xxx doesn't exist anymore') in order to invite the user to refresh data ?

andrealonzo commented 8 years ago

It doesn't look like this type of message can be generated at the model level. The mongoose-id-validator plugin checks to see if all the consumer_ids in the consumers array exist, but it doesn't know which ones don't exist.

I was thinking this could be handled in the vehicle handler, but after looking at updateConsumers, it also doesn't specify which consumer is being added.

I don't think it's possible to have a message saying 'consumer xxx doesn't exist anymore ', but we can make a message saying "There was an error adding consumer to vehicle" or have a very generic faceook like message

"This content is no longer available" "The content you requested cannot be displayed right now. It may be temporarily unavailable, the link you clicked on may have expired, or you may not have permission to view this page."

andrealonzo commented 8 years ago

I'm going to close this. I think we'll need to discuss overall error handling and messages in a different issue.