Store error
in page store (when an error page is triggered)
#1498
Store error
in page store (when an error page is triggered)
#1498
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks! And thanks for all your work on the prettier plugin too!
f27a32a
to
e6b91ad
Compare
@@ -14,7 +14,7 @@ Inside a component, get references to the stores like so: | |||
``` | |||
|
|||
* `preloading` contains a readonly boolean value, indicating whether or not a navigation is pending | |||
* `page` contains a readonly `{ host, path, params, query }` object, identical to that passed to `preload` functions | |||
* `page` contains a readonly `{ host, path, params, query, error, status }` object. The same value is passed to `preload` functions, though `status` is not present at that time and `error` is only set on error pages. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering now if my suggestion to add status
maybe wasn't a good one. I hadn't thought through the fact that it wouldn't be available yet in preload
. I wonder if it's that useful in this case and maybe that's too much of a caveat to actually add it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I wouldn't mind removing it again. I generally don't find it particularly useful and the concept of an http status code doesn't really make sense on the client side. I'll take it out again.
Looks like this will need to be rebased since your other PR was merged |
3ad205a
to
3aa12a9
Compare
Updated Sapper to 0.28.9 --- sveltejs/sapper#948 sveltejs/sapper#1498
To fix #948, store the current error in the
page
store to allow the layout to know whether the current page is an error page (as per suggestion by @Conduitry).My first PR in this project, so very open to feedback :)
Before submitting the PR, please make sure you do the following
Tests
npm test
and lint the project withnpm run lint