nicolium: ok it's in alpha for a reason

Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
nicole mikołajczyk
2026-02-15 14:09:44 +01:00
parent 9f98b5b07d
commit e05c4d5ba9
17 changed files with 45 additions and 32 deletions

View File

@ -508,7 +508,7 @@ const submitCompose =
local_only: compose.localOnly,
interaction_policy:
(['public', 'unlisted', 'private'].includes(compose.visibility) &&
compose.interactionPolicy) ??
compose.interactionPolicy) ||
undefined,
quote_approval_policy: compose.quoteApprovalPolicy ?? undefined,
location_id: compose.location?.origin_id ?? undefined,

View File

@ -25,7 +25,7 @@ const pleromaDecoder = (json: string) => decodePleromaData(JSON.parse(json));
// Should be called inside a try-catch.
const decodeFromMarkup = (elementId: string, decoder: (json: string) => Record<string, any>) => {
const { textContent } = document.getElementById(elementId)!;
return decoder(textContent);
return decoder(textContent as string);
};
const preloadFromMarkup =

View File

@ -216,7 +216,7 @@ const fetchHomeTimeline =
if (expand && state.timelines.home?.isLoading) return;
const fn =
(expand && state.timelines.home?.next?.()) ?? getClient(state).timelines.homeTimeline(params);
(expand && state.timelines.home?.next?.()) || getClient(state).timelines.homeTimeline(params);
return dispatch(handleTimelineExpand('home', fn, done));
};
@ -242,7 +242,7 @@ const fetchPublicTimeline =
if (expand && state.timelines[timelineId]?.isLoading) return;
const fn =
(expand && state.timelines[timelineId]?.next?.()) ??
(expand && state.timelines[timelineId]?.next?.()) ||
getClient(state).timelines.publicTimeline(params);
return dispatch(handleTimelineExpand(timelineId, fn, done, onError));
@ -260,7 +260,7 @@ const fetchBubbleTimeline =
if (expand && state.timelines[timelineId]?.isLoading) return;
const fn =
(expand && state.timelines[timelineId]?.next?.()) ??
(expand && state.timelines[timelineId]?.next?.()) ||
getClient(state).timelines.bubbleTimeline(params);
return dispatch(handleTimelineExpand(timelineId, fn, done));
@ -278,7 +278,7 @@ const fetchWrenchedTimeline =
if (expand && state.timelines[timelineId]?.isLoading) return;
const fn =
(expand && state.timelines[timelineId]?.next?.()) ??
(expand && state.timelines[timelineId]?.next?.()) ||
getClient(state).timelines.wrenchedTimeline(params);
return dispatch(handleTimelineExpand(timelineId, fn, done));
@ -303,7 +303,7 @@ const fetchAccountTimeline =
if (expand && state.timelines[timelineId]?.isLoading) return;
const fn =
(expand && state.timelines[timelineId]?.next?.()) ??
(expand && state.timelines[timelineId]?.next?.()) ||
getClient(state).accounts.getAccountStatuses(accountId, params);
return dispatch(handleTimelineExpand(timelineId, fn, done));
@ -321,7 +321,7 @@ const fetchListTimeline =
if (expand && state.timelines[timelineId]?.isLoading) return;
const fn =
(expand && state.timelines[timelineId]?.next?.()) ??
(expand && state.timelines[timelineId]?.next?.()) ||
getClient(state).timelines.listTimeline(listId, params);
return dispatch(handleTimelineExpand(timelineId, fn, done));
@ -339,7 +339,7 @@ const fetchCircleTimeline =
if (expand && state.timelines[timelineId]?.isLoading) return;
const fn =
(expand && state.timelines[timelineId]?.next?.()) ??
(expand && state.timelines[timelineId]?.next?.()) ||
getClient(state).circles.getCircleStatuses(circleId, params);
return dispatch(handleTimelineExpand(timelineId, fn, done));
@ -357,7 +357,7 @@ const fetchAntennaTimeline =
if (expand && state.timelines[timelineId]?.isLoading) return;
const fn =
(expand && state.timelines[timelineId]?.next?.()) ??
(expand && state.timelines[timelineId]?.next?.()) ||
getClient(state).timelines.antennaTimeline(antennaId, params);
return dispatch(handleTimelineExpand(timelineId, fn, done));
@ -376,7 +376,7 @@ const fetchGroupTimeline =
if (expand && state.timelines[timelineId]?.isLoading) return;
const fn =
(expand && state.timelines[timelineId]?.next?.()) ??
(expand && state.timelines[timelineId]?.next?.()) ||
getClient(state).timelines.groupTimeline(groupId, params);
return dispatch(handleTimelineExpand(timelineId, fn, done));
@ -399,7 +399,7 @@ const fetchHashtagTimeline =
if (useSettingsStore.getState().settings.autoTranslate) params.language = getLocale();
const fn =
(expand && state.timelines[timelineId]?.next?.()) ??
(expand && state.timelines[timelineId]?.next?.()) ||
getClient(state).timelines.hashtagTimeline(hashtag, params);
return dispatch(handleTimelineExpand(timelineId, fn, done));
@ -418,7 +418,7 @@ const fetchLinkTimeline =
if (useSettingsStore.getState().settings.autoTranslate) params.language = getLocale();
const fn =
(expand && state.timelines[timelineId]?.next?.()) ??
(expand && state.timelines[timelineId]?.next?.()) ||
getClient(state).timelines.linkTimeline(url, params);
return dispatch(handleTimelineExpand(timelineId, fn, done));

View File

@ -84,7 +84,7 @@ const DropdownNavigation: React.FC = React.memo((): JSX.Element | null => {
);
const getOtherAccounts = useCallback(makeGetOtherAccounts(), []);
const { account } = useAccount(me ?? undefined);
const { account } = useAccount(me || undefined);
const otherAccounts = useAppSelector((state) => getOtherAccounts(state));
const settings = useSettings();
const followRequestsCount = useFollowRequestsCount().data ?? 0;

View File

@ -384,7 +384,7 @@ const MediaGallery: React.FC<IMediaGallery> = (props) => {
className='size-4 min-w-fit text-gray-800 dark:text-gray-200'
src={
MIMETYPE_ICONS[
(attachment.type === 'unknown' && attachment.mime_type) ?? attachment.type
(attachment.type === 'unknown' && attachment.mime_type) || attachment.type
] ?? require('@phosphor-icons/core/regular/paperclip.svg')
}
/>

View File

@ -215,6 +215,7 @@ function parseContent(
if (!(domNode instanceof Element)) {
// @ts-ignore
domNode.preGreentext =
// @ts-ignore
(!domNode.prev || domNode.prev.preGreentext) && !domNode.data.trim().length;
// @ts-ignore

View File

@ -65,7 +65,7 @@ const isTreeScrollable = (element: HTMLElement, direction: DIRECTION): boolean =
interface PullToRefreshProps {
isPullable?: boolean;
onRefresh?: () => Promise<any>;
onRefresh?: () => Promise<any> | void;
refreshingContent?: JSX.Element | string;
pullingContent?: JSX.Element | string;
children: JSX.Element;
@ -217,7 +217,15 @@ const PullToRefresh: React.FC<PullToRefreshProps> = ({
childrenRef.current.style.overflow = 'visible';
childrenRef.current.style.transform = `translate(0px, ${pullDownThreshold}px)`;
}
onRefresh?.().then(initContainer).catch(initContainer);
if (onRefresh) {
const result = onRefresh();
if (result instanceof Promise) {
result.then(initContainer).catch(initContainer);
} else {
initContainer();
}
}
};
return (

View File

@ -54,7 +54,7 @@ const SidebarNavigationLink = React.memo(
>
<span className='⁂-sidebar-navigation-link__icon' aria-hidden>
<Icon
src={(isActive && activeIcon) ?? icon}
src={(isActive && activeIcon) || icon}
count={demetricator ? undefined : count}
countMax={countMax}
/>

View File

@ -187,7 +187,7 @@ const Status: React.FC<IStatus> = (props) => {
const getStatus = useMemo(makeGetStatus, []);
const actualStatus = useAppSelector(
(state) => (status.reblog_id && getStatus(state, { id: status.reblog_id })) ?? status,
(state) => (status.reblog_id && getStatus(state, { id: status.reblog_id })!) || status,
);
const { mutate: favouriteStatus } = useFavouriteStatus(actualStatus.id);

View File

@ -30,7 +30,7 @@ const ThumbNavigationLink: React.FC<IThumbNavigationLink> = ({
const icon =
(activeSrc &&
matchRoute({ to: props.to, params: props.params, search: props.search }) !== false &&
activeSrc) ??
activeSrc) ||
src;
return (

View File

@ -49,7 +49,7 @@ const canRemoteTranslate = (
type Availability = Awaited<ReturnType<typeof Translator.availability>>;
const localTranslationAvailability = (
const localTranslationAvailability = async (
status: ITranslateButton['status'],
locale: string,
): Promise<Availability | false> => {

View File

@ -1,3 +1,4 @@
import type { Entities } from './entities';
import type { EntitiesTransaction, Entity, EntityListState, ImportPosition } from './types';
const ENTITIES_IMPORT = 'ENTITIES_IMPORT' as const;
@ -12,7 +13,7 @@ const ENTITIES_TRANSACTION = 'ENTITIES_TRANSACTION' as const;
/** Action to import entities into the cache. */
const importEntities = (
entities: Entity[],
entityType: string,
entityType: Entities,
listKey?: string,
pos?: ImportPosition,
) => ({
@ -53,7 +54,7 @@ const entitiesFetchRequest = (entityType: string, listKey?: string) => ({
const entitiesFetchSuccess = (
entities: Entity[],
entityType: string,
entityType: Entities,
listKey?: string,
pos?: ImportPosition,
newState?: EntityListState,
@ -68,14 +69,14 @@ const entitiesFetchSuccess = (
overwrite,
});
const entitiesFetchFail = (entityType: string, listKey: string | undefined, error: any) => ({
const entitiesFetchFail = (entityType: Entities, listKey: string | undefined, error: any) => ({
type: ENTITIES_FETCH_FAIL,
entityType,
listKey,
error,
});
const invalidateEntityList = (entityType: string, listKey: string) => ({
const invalidateEntityList = (entityType: Entities, listKey: string) => ({
type: ENTITIES_INVALIDATE_LIST,
entityType,
listKey,

View File

@ -1,3 +1,4 @@
import type { Entities } from '../entities';
import type { Entity } from '../types';
import type { BaseSchema, BaseIssue } from 'valibot';
@ -10,7 +11,7 @@ type EntitySchema<TEntity extends Entity = Entity> = BaseSchema<any, TEntity, Ba
*/
type ExpandedEntitiesPath = [
/** Name of the entity type for use in the global cache, eg `'Notification'`. */
entityType: string,
entityType: Entities,
/**
* Name of a particular index of this entity type.
* Multiple params get combined into one string with a `:` separator.
@ -19,10 +20,10 @@ type ExpandedEntitiesPath = [
];
/** Used to look up an entity in a list. */
type EntitiesPath = [entityType: string, listKey: string];
type EntitiesPath = [entityType: Entities, listKey: string];
/** Used to look up a single entity by its ID. */
type EntityPath = [entityType: string, entityId: string];
type EntityPath = [entityType: Entities, entityId: string];
/** Callback functions for entity actions. */
interface EntityCallbacks<Value, Error = unknown> {

View File

@ -4,6 +4,7 @@ import { useLoading } from '@/hooks/use-loading';
import { deleteEntities, importEntities } from '../actions';
import type { Entities } from '../entities';
import type { EntityCallbacks, EntityFn } from './types';
/**
@ -11,7 +12,7 @@ import type { EntityCallbacks, EntityFn } from './types';
* This hook should be used to globally delete an entity from all lists.
* To remove an entity from a single list, see `useDismissEntity`.
*/
const useDeleteEntity = (entityType: string, entityFn: EntityFn<string>) => {
const useDeleteEntity = (entityType: Entities, entityFn: EntityFn<string>) => {
const dispatch = useAppDispatch();
const getState = useGetState();
const [isSubmitting, setPromise] = useLoading();

View File

@ -8,6 +8,7 @@ import { useLoading } from '@/hooks/use-loading';
import { importEntities } from '../actions';
import { findEntity } from '../selectors';
import type { Entities } from '../entities';
import type { Entity } from '../types';
import type { EntityFn } from './types';
import type { UseEntityOpts } from './use-entity';
@ -17,7 +18,7 @@ import type { PlfeResponse } from '@/api';
type LookupFn<TEntity extends Entity> = (entity: TEntity) => boolean;
const useEntityLookup = <TEntity extends Entity, TTransformedEntity extends Entity = TEntity>(
entityType: string,
entityType: Entities,
lookupFn: LookupFn<TTransformedEntity>,
entityFn: EntityFn<void>,
opts: UseEntityOpts<TEntity, TTransformedEntity> = {},

View File

@ -644,7 +644,7 @@ const compose = (
const contentType =
action.contentType === 'text/markdown' && state.default.contentType === 'wysiwyg'
? 'wysiwyg'
: (action.contentType ?? 'text/plain');
: action.contentType || 'text/plain';
compose.contentType = contentType;
compose.quoteId = action.status.quote_id;
compose.groupId = action.status.group_id;

View File

@ -177,8 +177,8 @@ const makeGetNotification = () =>
createSelector(
[
(_state: RootState, notification: NotificationGroup) => notification,
// @ts-expect-error types will be fine valibot ensures that
(state: RootState, notification: NotificationGroup) =>
// @ts-expect-error types will be fine valibot ensures that
selectAccount(state, notification.target_id),
// @ts-expect-error types will be fine valibot ensures that
(state: RootState, notification: NotificationGroup) => state.statuses[notification.status_id],