Currently the ErrorView component decides what error message to show based on a series of boolean prop values.
As ErrorView gets more use this isn't exactly scalable.
See this comment for a possible solution.
Also refactor this component to a functional component.
@supernova-at @sirugh @jimbo we can refactor this to a function component and create a config map that holds error message, view component location against error code.
The ErrorView Component will receive the error_code as prop and we can get the component lazy loaded at runtime. The view component (like toast, container, alert) can be decided and changed as a config.
Is this good to proceed?
@jimbo had some definitive thoughts on this one so I'll defer to him
So, ErrorView is designed to be a page-level view that reflects server-side routing states:
loadingnotFoundinternalErrorIt was not designed to be rendered within other pages as a generic error view, and not designed to have other arbitrary error states added to its internal map. At some point, though, that's exactly what happened: a change was made to the Product component and outOfStock was added to the map.
Here's what I'd like to see:
outOfStock from ErrorViewErrorView from Product and replace it with the new component@dani97 I like your concept, and I think it would work for the new component described above.
@jimbo @supernova-at I will work on it now can not assign meself on the issue
Most helpful comment
So,
ErrorViewis designed to be a page-level view that reflects server-side routing states:loadingnotFoundinternalErrorIt was not designed to be rendered within other pages as a generic error view, and not designed to have other arbitrary error states added to its internal map. At some point, though, that's exactly what happened: a change was made to the
Productcomponent andoutOfStockwas added to the map.Here's what I'd like to see:
outOfStockfromErrorViewErrorViewfromProductand replace it with the new component@dani97 I like your concept, and I think it would work for the new component described above.