Merge pull request #308 from cheeaun/main

Update from main
This commit is contained in:
Chee Aun 2023-11-07 00:52:17 +08:00 committed by GitHub
commit a75b214999
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 14 deletions

View file

@ -466,15 +466,6 @@ const fetchLists = pmem(
maxAge: FETCH_MAX_AGE, maxAge: FETCH_MAX_AGE,
}, },
); );
const fetchFollowedHashtags = pmem(
() => {
const { masto } = api();
return masto.v1.followedTags.list();
},
{
maxAge: FETCH_MAX_AGE,
},
);
function ShortcutForm({ function ShortcutForm({
onSubmit, onSubmit,
@ -486,6 +477,7 @@ function ShortcutForm({
console.log('shortcut', shortcut); console.log('shortcut', shortcut);
const editMode = !!shortcut; const editMode = !!shortcut;
const [currentType, setCurrentType] = useState(shortcut?.type || null); const [currentType, setCurrentType] = useState(shortcut?.type || null);
const { masto } = api();
const [uiState, setUIState] = useState('default'); const [uiState, setUIState] = useState('default');
const [lists, setLists] = useState([]); const [lists, setLists] = useState([]);
@ -508,7 +500,7 @@ function ShortcutForm({
(async () => { (async () => {
if (currentType !== 'hashtag') return; if (currentType !== 'hashtag') return;
try { try {
const iterator = fetchFollowedHashtags(); const iterator = masto.v1.followedTags.list();
const tags = []; const tags = [];
do { do {
const { value, done } = await iterator.next(); const { value, done } = await iterator.next();

View file

@ -101,7 +101,7 @@ function Shortcuts() {
{formattedShortcuts.map( {formattedShortcuts.map(
({ id, path, title, subtitle, icon }, i) => { ({ id, path, title, subtitle, icon }, i) => {
return ( return (
<li key={i + title}> <li key={`${i}-${id}-${title}-${subtitle}-${path}`}>
<Link <Link
class={subtitle ? 'has-subtitle' : ''} class={subtitle ? 'has-subtitle' : ''}
to={path} to={path}
@ -170,9 +170,13 @@ function Shortcuts() {
</button> </button>
} }
> >
{formattedShortcuts.map(({ path, title, subtitle, icon }, i) => { {formattedShortcuts.map(({ id, path, title, subtitle, icon }, i) => {
return ( return (
<MenuLink to={path} key={i + title} class="glass-menu-item"> <MenuLink
to={path}
key={`${i}-${id}-${title}-${subtitle}-${path}`}
class="glass-menu-item"
>
<Icon icon={icon} size="l" />{' '} <Icon icon={icon} size="l" />{' '}
<span class="menu-grow"> <span class="menu-grow">
<span> <span>

View file

@ -216,7 +216,8 @@ function Notifications({ columnMode }) {
let unsub; let unsub;
if (visible) { if (visible) {
const timeDiff = Date.now() - lastHiddenTime.current; const timeDiff = Date.now() - lastHiddenTime.current;
if (!lastHiddenTime.current || timeDiff > 1000 * 60) { if (!lastHiddenTime.current || timeDiff > 1000 * 3) {
// 3 seconds
loadUpdates({ loadUpdates({
disableIdleCheck: true, disableIdleCheck: true,
}); });