-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Обработка ошибок GraphQL #120
Conversation
#88 - на секунду показывается страница UserInfo |
Visit the preview URL for this PR (updated for commit 23998d0):
(expires Tue, 15 Dec 2020 19:04:00 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 |
Пока некритично, но до показа бы исправить, что на какое-то время мелькает сама страница Т.е. в идеале должна быть сначала проверка на доступ к ресурсу (для 404), и только если ок - уже отображаем сам page (может имеет смысл какой-нить флаг accessLoading добавить на верхнем уровне, и только как она станет false - отображать чайлдов гарантированно) В рамках PR - пофиг пока, но ишью бы выписать
Да, да - поправить бы - выпиши issue себе |
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.
Все круто, но го еще добьем моменты некоторые, чтоб точно до ума довести
…o feature/error-handling � Conflicts: � src/pages/home/index.tsx � src/pages/index.tsx
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.
Вливай. Остальное позже пофиксим
Молодец 👍
Реализация - пушка
import withRouter from "./with-router"; | ||
|
||
// Потом какой-нибудь `compose` метод заинсталлим откуда-нить и покрасивше будет | ||
export const withHocs = (component: () => JSX.Element) => withRouter(withApollo(component)); |
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.
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.
там с пропсами
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.
Так можно же props?: P
выставить)
@@ -34,7 +34,7 @@ const client = new ApolloClient({ | |||
/** | |||
* Обертка для подключения и работы с API | |||
*/ | |||
const withApollo = (component: () => React.ReactNode) => () => ( | |||
const withApollo = (component: () => JSX.Element) => () => ( |
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.
import withApollo from "./with-apollo"; | ||
import withRouter from "./with-router"; | ||
|
||
// Потом какой-нибудь `compose` метод заинсталлим откуда-нить и покрасивше будет |
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.
😄
@@ -3,10 +3,12 @@ import React, { Suspense } from "react"; | |||
import { BrowserRouter, Route } from "react-router-dom"; | |||
import { QueryParamProvider } from "use-query-params"; | |||
|
|||
export const setupRouter = (component: () => JSX.Element) => () => ( | |||
const withRouter = (component: () => JSX.Element) => () => ( |
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.
Потом бы добавил коммент, аля
/**
* Инициализация роутера с провайдером для работы с get-параметрами
*/
import Header from "./header"; | ||
import "./index.scss"; | ||
import { withHocs } from "./hocs"; |
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.
Круто, но стили в самом низу располагают обычно)
imports/order увы не удается пока для этого настроить
import Header from "./header"; | ||
import "./index.scss"; | ||
import { withHocs } from "./hocs"; | ||
|
||
const ErrorPage = lazy(() => import("pages/error")); |
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.
Чет смущает, что ErrorPage тут так хардкодится... Но ладно, потом посмотрим что с этим можно сделать. Потом в след коммитах пометь как-нибудь
// !!! FIXME: manage access
q: currentTarget.value, | ||
type: query.type, | ||
s: query.s, | ||
o: query.o, |
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.
Потом бы на такое заменил
const q = currentTarget.value;
history.push(`/search?${qs.stringify({ ...query, q })}`);
Closes #4
Closes #31