After chapter 5 things are starting to gel. I’m now finding the ‘principle of least surprise’ applies:
- "Hmm, I don’t like that validation error message. What if I add another parameter
message: "my user friendly message
? And it worked. - File upload functionality had some of the File API that looks a lot like Ruby’s, so again principle of least surprise
- I can now work test-first more often. Tests for the Search page context were straight forward. Thanks to this forum I found the
errors_on
function inDataCase
to write more readable and precise tests for error messages. - DRYing the validation for a 7 digit SKU was easy (extract function in
Product
and reuse that inProductSearch
.)
I skipped the image upload error handling exercise in Your Turn
for now. I don’t need image uploads any time soon. It was fun to do the exercise in the chapter, as it gives more of a feel for handling state and working with files. Also, I want to skip ahead. I want to extract duplicate HTML in the search page. I copied the HTML from products/show
and it looks like I need a function component for that, which is covered in the next chapter. Onward!