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
+8
-3
No files matched your search
@@ -49,7 +49,10 @@ 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;
|
||||||
|
|
||||||
|
function getEmbedDebuggerPreviewChannel(): Channel {
|
||||||
|
embedDebuggerPreviewChannel ??= new Channel({
|
||||||
id: EMBED_DEBUGGER_PREVIEW_CHANNEL_ID,
|
id: EMBED_DEBUGGER_PREVIEW_CHANNEL_ID,
|
||||||
type: ChannelTypes.DM_PERSONAL_NOTES,
|
type: ChannelTypes.DM_PERSONAL_NOTES,
|
||||||
name: undefined,
|
name: undefined,
|
||||||
@@ -72,6 +75,8 @@ const EMBED_DEBUGGER_PREVIEW_CHANNEL = new Channel({
|
|||||||
rate_limit_per_user: 0,
|
rate_limit_per_user: 0,
|
||||||
nicks: {},
|
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