mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-07 01:09:54 +08:00
style: add perf rules (#5413)
This commit is contained in:
@@ -244,8 +244,7 @@ const states: Partial<Record<ArticleId, EdgelessSwitchState>> = {
|
||||
|
||||
export const articles: Record<ArticleId, ArticleOption> = ids.reduce(
|
||||
(acc, id) => {
|
||||
return {
|
||||
...acc,
|
||||
return Object.assign(acc, {
|
||||
[id]: {
|
||||
id,
|
||||
location: paperLocations[id],
|
||||
@@ -254,7 +253,7 @@ export const articles: Record<ArticleId, ArticleOption> = ids.reduce(
|
||||
blocks: contents[id],
|
||||
initState: states[id],
|
||||
} satisfies ArticleOption,
|
||||
};
|
||||
});
|
||||
},
|
||||
{} as Record<ArticleId, ArticleOption>
|
||||
);
|
||||
|
||||
@@ -45,10 +45,9 @@ export function useI18N() {
|
||||
return i18n;
|
||||
}
|
||||
|
||||
const resources = LOCALES.reduce<Resource>(
|
||||
(acc, { tag, res }) => ({ ...acc, [tag]: { translation: res } }),
|
||||
{}
|
||||
);
|
||||
const resources = LOCALES.reduce<Resource>((acc, { tag, res }) => {
|
||||
return Object.assign(acc, { [tag]: { translation: res } });
|
||||
}, {});
|
||||
|
||||
const fallbackLng = 'en';
|
||||
const standardizeLocale = (language: string) => {
|
||||
|
||||
@@ -27,9 +27,9 @@ export const flattenTranslation = (
|
||||
if (!(obj instanceof Object)) return { [path ?? '']: obj };
|
||||
|
||||
return Object.keys(obj).reduce((output, key) => {
|
||||
return {
|
||||
...output,
|
||||
...flattenTranslation(obj[key], path ? path + '.' + key : key),
|
||||
};
|
||||
return Object.assign(
|
||||
output,
|
||||
flattenTranslation(obj[key], path ? path + '.' + key : key)
|
||||
);
|
||||
}, {});
|
||||
};
|
||||
|
||||
@@ -42,10 +42,9 @@ export function createCloudAwarenessProvider(
|
||||
return;
|
||||
}
|
||||
|
||||
const changedClients = Object.values(changes).reduce((res, cur) => [
|
||||
...res,
|
||||
...cur,
|
||||
]);
|
||||
const changedClients = Object.values(changes).reduce((res, cur) =>
|
||||
res.concat(cur)
|
||||
);
|
||||
|
||||
const update = encodeAwarenessUpdate(awareness, changedClients);
|
||||
uint8ArrayToBase64(update)
|
||||
|
||||
@@ -23,10 +23,9 @@ export function createBroadcastChannelAwarenessProvider(
|
||||
return;
|
||||
}
|
||||
|
||||
const changedClients = Object.values(changes).reduce((res, cur) => [
|
||||
...res,
|
||||
...cur,
|
||||
]);
|
||||
const changedClients = Object.values(changes).reduce((res, cur) =>
|
||||
res.concat(cur)
|
||||
);
|
||||
|
||||
const update = encodeAwarenessUpdate(awareness, changedClients);
|
||||
channel.postMessage({
|
||||
|
||||
Reference in New Issue
Block a user