-
Notifications
You must be signed in to change notification settings - Fork 15
HT6 #37
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
base: master
Are you sure you want to change the base?
HT6 #37
Conversation
* Не загружаются все комменты если были когда-то загружены
…comment?limit=5&offset=10) HT6.3 Загружаю каждую страницу только один раз
…считывается динамически. Пофиксил загрузкой первой страницы по умолчанию
if (!loading && !pagesLoaded.includes(page) && fetchAll) { | ||
fetchAll(DEFAULT_OFFSET * (page - 1), page) | ||
} | ||
}, [page]) |
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.
не знаю что это но чувствую что тут должно быть page. Если я правильно понял, это условие, при каких обстоятельствах вызывать useEffect
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 { loading, fetchAll, page, pagesLoaded } = props | ||
useEffect(() => { | ||
if (!loading && !pagesLoaded.includes(page) && fetchAll) { | ||
fetchAll(DEFAULT_OFFSET * (page - 1), page) |
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.
я бы передавал page, а уже в AC превращал это в offset и limit
if (!loading && !pagesLoaded.includes(page) && fetchAll) { | ||
fetchAll(DEFAULT_OFFSET * (page - 1), page) | ||
} | ||
}, [page]) |
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.
Хороший вопрос для разбора в начале урока, задай в слаке
loading: false, | ||
loaded: false, | ||
total: 0, | ||
pagesLoaded: List([]) |
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.
Set
рекомендовал бы
Первый коммит:
Второй коммит: