mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-17 13:05:32 +09:00
fix(app): build settings preview state lazily at first use (#1935)
This commit is contained in:
1 parent
14e63085dd
commit
455681b24c
2 files changed
+30
-25
No files matched your search
@@ -49,29 +49,34 @@ const UNABLE_TO_UNFURL_URL_DESCRIPTOR = msg({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const EMBED_DEBUGGER_PREVIEW_CHANNEL_ID = '0';
|
const EMBED_DEBUGGER_PREVIEW_CHANNEL_ID = '0';
|
||||||
const EMBED_DEBUGGER_PREVIEW_CHANNEL = new Channel({
|
let embedDebuggerPreviewChannel: Channel | null = null;
|
||||||
id: EMBED_DEBUGGER_PREVIEW_CHANNEL_ID,
|
|
||||||
type: ChannelTypes.DM_PERSONAL_NOTES,
|
function getEmbedDebuggerPreviewChannel(): Channel {
|
||||||
name: undefined,
|
embedDebuggerPreviewChannel ??= new Channel({
|
||||||
topic: null,
|
id: EMBED_DEBUGGER_PREVIEW_CHANNEL_ID,
|
||||||
url: null,
|
type: ChannelTypes.DM_PERSONAL_NOTES,
|
||||||
icon: null,
|
name: undefined,
|
||||||
owner_id: null,
|
topic: null,
|
||||||
last_message_id: null,
|
url: null,
|
||||||
last_pin_timestamp: null,
|
icon: null,
|
||||||
recipients: undefined,
|
owner_id: null,
|
||||||
parent_id: null,
|
last_message_id: null,
|
||||||
bitrate: null,
|
last_pin_timestamp: null,
|
||||||
user_limit: null,
|
recipients: undefined,
|
||||||
voice_connection_limit: null,
|
parent_id: null,
|
||||||
rtc_region: null,
|
bitrate: null,
|
||||||
nsfw: false,
|
user_limit: null,
|
||||||
nsfw_override: null,
|
voice_connection_limit: null,
|
||||||
content_warning_level: 0,
|
rtc_region: null,
|
||||||
content_warning_text: null,
|
nsfw: false,
|
||||||
rate_limit_per_user: 0,
|
nsfw_override: null,
|
||||||
nicks: {},
|
content_warning_level: 0,
|
||||||
});
|
content_warning_text: null,
|
||||||
|
rate_limit_per_user: 0,
|
||||||
|
nicks: {},
|
||||||
|
});
|
||||||
|
return embedDebuggerPreviewChannel;
|
||||||
|
}
|
||||||
|
|
||||||
function withPreviewAuthorFallback<T extends EmbedAuthorResponse | null | undefined>(author: T): T {
|
function withPreviewAuthorFallback<T extends EmbedAuthorResponse | null | undefined>(author: T): T {
|
||||||
if (!author || author.proxy_icon_url || !author.icon_url) return author;
|
if (!author || author.proxy_icon_url || !author.icon_url) return author;
|
||||||
@@ -171,7 +176,7 @@ const EmbedJsonCodeBlock: React.FC<{json: string}> = ({json}) => {
|
|||||||
const EmbedDebuggerPreview: React.FC<{message: Message}> = observer(({message}) => {
|
const EmbedDebuggerPreview: React.FC<{message: Message}> = observer(({message}) => {
|
||||||
const contextValue = useMemo(
|
const contextValue = useMemo(
|
||||||
() => ({
|
() => ({
|
||||||
channel: EMBED_DEBUGGER_PREVIEW_CHANNEL,
|
channel: getEmbedDebuggerPreviewChannel(),
|
||||||
message,
|
message,
|
||||||
shouldGroup: false,
|
shouldGroup: false,
|
||||||
isHovering: false,
|
isHovering: false,
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ export async function makeSyncedField<
|
|||||||
reaction(
|
reaction(
|
||||||
() => ({
|
() => ({
|
||||||
snapshot: getRemoteSnapshot(),
|
snapshot: getRemoteSnapshot(),
|
||||||
userId: SessionManager.userId,
|
userId: SessionManager?.userId ?? null,
|
||||||
hydrated: UserSettings.isHydrated(),
|
hydrated: UserSettings.isHydrated(),
|
||||||
}),
|
}),
|
||||||
({snapshot, userId, hydrated}) => {
|
({snapshot, userId, hydrated}) => {
|
||||||
|
|||||||
Reference in new issue
Block a user