mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-03-21 21:29:20 +01:00
Let's try this out
Sometimes the logic gets confusing
This commit is contained in:
parent
7f327e5980
commit
89f82707d6
1 changed files with 5 additions and 3 deletions
|
@ -54,8 +54,6 @@ function Notifications({ columnMode }) {
|
||||||
|
|
||||||
const notificationsIterator = useRef();
|
const notificationsIterator = useRef();
|
||||||
async function fetchNotifications(firstLoad) {
|
async function fetchNotifications(firstLoad) {
|
||||||
states.notificationsShowNew = false; // Hide "new notifications" button early
|
|
||||||
|
|
||||||
if (firstLoad || !notificationsIterator.current) {
|
if (firstLoad || !notificationsIterator.current) {
|
||||||
// Reset iterator
|
// Reset iterator
|
||||||
notificationsIterator.current = masto.v1.notifications.list({
|
notificationsIterator.current = masto.v1.notifications.list({
|
||||||
|
@ -176,6 +174,8 @@ function Notifications({ columnMode }) {
|
||||||
// }
|
// }
|
||||||
// }, [nearReachEnd, showMore]);
|
// }, [nearReachEnd, showMore]);
|
||||||
|
|
||||||
|
const [showNew, setShowNew] = useState(false);
|
||||||
|
|
||||||
const loadUpdates = useCallback(
|
const loadUpdates = useCallback(
|
||||||
({ disableIdleCheck = false } = {}) => {
|
({ disableIdleCheck = false } = {}) => {
|
||||||
console.log('✨ Load updates', {
|
console.log('✨ Load updates', {
|
||||||
|
@ -195,6 +195,8 @@ function Notifications({ columnMode }) {
|
||||||
uiState !== 'loading'
|
uiState !== 'loading'
|
||||||
) {
|
) {
|
||||||
loadNotifications(true);
|
loadNotifications(true);
|
||||||
|
} else {
|
||||||
|
setShowNew(snapStates.notificationsShowNew);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[snapStates.notificationsShowNew, snapStates.settings.autoRefresh, uiState],
|
[snapStates.notificationsShowNew, snapStates.settings.autoRefresh, uiState],
|
||||||
|
@ -291,7 +293,7 @@ function Notifications({ columnMode }) {
|
||||||
{/* <Loader hidden={uiState !== 'loading'} /> */}
|
{/* <Loader hidden={uiState !== 'loading'} /> */}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{snapStates.notificationsShowNew && uiState !== 'loading' && (
|
{showNew && uiState !== 'loading' && (
|
||||||
<button
|
<button
|
||||||
class="updates-button shiny-pill"
|
class="updates-button shiny-pill"
|
||||||
type="button"
|
type="button"
|
||||||
|
|
Loading…
Reference in a new issue