diff --git a/src/client/webapp/elements/components/input-image-edit.tsx b/src/client/webapp/elements/components/input-image-edit.tsx index 00a2def..5f47e64 100644 --- a/src/client/webapp/elements/components/input-image-edit.tsx +++ b/src/client/webapp/elements/components/input-image-edit.tsx @@ -50,8 +50,8 @@ const ImageEditInput: FC = (props: ImageEditInputProps) => return './img/error.png'; } }, + [value, setValid, isMounted, setMessage], './img/loading.svg', - [value], ); useEffect(() => { diff --git a/src/client/webapp/elements/components/token-row.tsx b/src/client/webapp/elements/components/token-row.tsx index 086683c..ae09aea 100644 --- a/src/client/webapp/elements/components/token-row.tsx +++ b/src/client/webapp/elements/components/token-row.tsx @@ -28,7 +28,7 @@ const TokenRow: FC = (props: TokenRowProps) => { const guildMeta = useRecoilValue(guildMetaState(guild.id)); - const [guildSocketConfigs] = useOneTimeAsyncAction(async () => await guild.fetchSocketConfigs(), null, [guild]); + const [guildSocketConfigs] = useOneTimeAsyncAction(async () => await guild.fetchSocketConfigs(), [guild], null); const iconSrc = useRecoilValueSoftImgSrc( guildResourceSoftImgSrcState({ guildId: guild.id, diff --git a/src/client/webapp/elements/overlays/overlay-add-guild.tsx b/src/client/webapp/elements/overlays/overlay-add-guild.tsx index 7151409..4c0846f 100644 --- a/src/client/webapp/elements/overlays/overlay-add-guild.tsx +++ b/src/client/webapp/elements/overlays/overlay-add-guild.tsx @@ -70,7 +70,7 @@ const AddGuildOverlay: FC = (props: AddGuildOverlayProps) const [avatarInputMessage, setAvatarInputMessage] = useState(null); const [avatarInputValid, setAvatarInputValid] = useState(false); - const [exampleAvatarBuff, exampleAvatarBuffError] = useOneTimeAsyncAction(async () => await fs.readFile(exampleAvatarPath), null, [exampleAvatarPath]); + const [exampleAvatarBuff, exampleAvatarBuffError] = useOneTimeAsyncAction(async () => await fs.readFile(exampleAvatarPath), [exampleAvatarPath], null); useEffect(() => { if (exampleAvatarBuff) { @@ -103,7 +103,7 @@ const AddGuildOverlay: FC = (props: AddGuildOverlayProps) setOverlay(null); return { result: newGuild, errorMessage: null }; - }, [displayName, avatarBuff, displayNameInputValid, avatarInputValid, setOverlay]); + }, [guildsManager, validationErrorMessage, expired, displayName, avatarBuff, setCurrGuildId, setOverlay, addGuildData]); const errorMessage = useMemo(() => { if (validationErrorMessage) return validationErrorMessage; @@ -114,11 +114,22 @@ const AddGuildOverlay: FC = (props: AddGuildOverlayProps) return (
- +
- +
= (props: ChannelOverlayProps) => setOverlay(null); return { result: null, errorMessage: null }; }, - [guild, edited, validationErrorMessage, name, flavorText, setOverlay], + [guild, edited, channel, validationErrorMessage, name, flavorText, setOverlay], { start: channel ? 'Modify Channel' : 'Create Channel' }, ); diff --git a/src/client/webapp/elements/overlays/overlay-personalize.tsx b/src/client/webapp/elements/overlays/overlay-personalize.tsx index 51cb86a..0be5fa6 100644 --- a/src/client/webapp/elements/overlays/overlay-personalize.tsx +++ b/src/client/webapp/elements/overlays/overlay-personalize.tsx @@ -99,7 +99,7 @@ const PersonalizeOverlay: FC = (props: PersonalizeOverl setOverlay(null); return { result: null, errorMessage: null }; }, - [validationErrorMessage, displayName, savedDisplayName, avatarBuff, savedAvatarBuff, setOverlay], + [validationErrorMessage, displayName, savedDisplayName, guild, avatarBuff, savedAvatarBuff, setOverlay], ); //if (saveFailed) return 'Unable to save personalization'; diff --git a/src/client/webapp/elements/require/react-helper.tsx b/src/client/webapp/elements/require/react-helper.tsx index 5c940f6..bfe1285 100644 --- a/src/client/webapp/elements/require/react-helper.tsx +++ b/src/client/webapp/elements/require/react-helper.tsx @@ -61,8 +61,8 @@ function useShake(ms: number): [shaking: boolean, doShake: () => void] { // runs an Async action one time (updates when deps changes) export function useOneTimeAsyncAction( actionFunc: () => Promise, - initialValue: V, deps: DependencyList, + initialValue: V, ): [value: T | V, error: unknown | null] { const isMounted = useRef(false); @@ -241,8 +241,8 @@ export function useDownloadButton( setText(textMapping.success); }, - // TODO: look into this warning - [downloadName, fetchBuff, ...fetchBuffDeps, filePath, fileBuffer], + // eslint-disable-next-line react-hooks/exhaustive-deps + [shaking, doShake, downloadName, fetchBuff, ...fetchBuffDeps, filePath, fileBuffer, textMapping.pendingFetch, textMapping.notReadyFetch, textMapping.errorFetch, textMapping.errorSave, textMapping.success], ); return [callable, text, shaking]; diff --git a/src/client/webapp/elements/sections/guild-list-container.tsx b/src/client/webapp/elements/sections/guild-list-container.tsx index fbd6b75..8cdbf0e 100644 --- a/src/client/webapp/elements/sections/guild-list-container.tsx +++ b/src/client/webapp/elements/sections/guild-list-container.tsx @@ -61,7 +61,7 @@ const GuildListContainer: FC = () => { } else { setOverlay(); } - }, []); + }, [setOverlay]); return (
diff --git a/src/client/webapp/elements/sections/send-message.tsx b/src/client/webapp/elements/sections/send-message.tsx index 003905c..a6d73e5 100644 --- a/src/client/webapp/elements/sections/send-message.tsx +++ b/src/client/webapp/elements/sections/send-message.tsx @@ -42,8 +42,8 @@ const AttachmentPreview: FC = (props: AttachmentPreviewP return './img/file-improved.svg'; } }, - './img/loading.svg', [attachmentBuff], + './img/loading.svg', ); return ( diff --git a/src/client/webapp/guild-combined.ts b/src/client/webapp/guild-combined.ts index b2cb07a..0ea3c2f 100644 --- a/src/client/webapp/guild-combined.ts +++ b/src/client/webapp/guild-combined.ts @@ -30,13 +30,11 @@ import EnsuredFetchable from './fetchable-ensured'; import { EventEmitter } from 'tsee'; import { AutoVerifierChangesType } from './auto-verifier'; import { IDQuery, PartialMessageListQuery } from './auto-verifier-with-args'; -import Util from './util'; /** the general guild class. This handles connecting a RAM, PersonalDB, and Socket guild together using fetchable-pair-verifiers and some manual caching to nicely update messages */ export default class CombinedGuild extends EventEmitter - implements AsyncGuaranteedFetchable, AsyncRequestable -{ + implements AsyncGuaranteedFetchable, AsyncRequestable { private readonly ramGuild: RAMGuild; private readonly personalDBGuild: PersonalDBGuild; private readonly socketGuild: SocketGuild; @@ -62,8 +60,8 @@ export default class CombinedGuild const diskSocket = new PairVerifierFetchable(this.personalDBGuild, this.socketGuild, 'disk-socket'); const ramDiskSocket = new PairVerifierFetchable(this.ramGuild, diskSocket, 'ram-disk'); - // TODO: I think this unverify is causing the RARE ALERTs - // do we need to unverify on connect? or just disconnect? + // TODO: I think this unverify is causing the RARE ALERTs + // do we need to unverify on connect? or just disconnect? // connect/Disconnect this.socketGuild.on('connect', () => { LOG.info(`g#${this.id} connected`); @@ -356,22 +354,22 @@ export default class CombinedGuild // fetched through the triple-cache system (RAM -> Disk -> Server) async fetchMetadata(): Promise { // xUtil.failSometimes(0.05); // for testing - LOG.debug(`g#${this.id}: fetch metadata`); + LOG.debug(`g#${this.id}: fetch metadata`); return await this.fetchable.fetchMetadata(); } async fetchMembers(): Promise { // xUtil.failSometimes(0.05); // for testing - LOG.debug(`g#${this.id}: fetch members`); + LOG.debug(`g#${this.id}: fetch members`); return await this.fetchable.fetchMembers(); } async fetchChannels(): Promise { // xUtil.failSometimes(0.05); // for testing - LOG.debug(`g#${this.id}: fetch channels`); + LOG.debug(`g#${this.id}: fetch channels`); return await this.fetchable.fetchChannels(); } async fetchMessagesRecent(channelId: string, number: number): Promise { // xUtil.failSometimes(0.05); // for testing - LOG.debug(`g#${this.id}: fetch recent messages ch#${channelId.slice(0, 4)}, ${number}`); + LOG.debug(`g#${this.id}: fetch recent messages ch#${channelId.slice(0, 4)}, ${number}`); const members = await this.grabRAMMembersMap(); const channels = await this.grabRAMChannelsMap(); const messages = await this.fetchable.fetchMessagesRecent(channelId, number); @@ -382,7 +380,7 @@ export default class CombinedGuild } async fetchMessagesBefore(channelId: string, messageOrderId: string, number: number): Promise { // xUtil.failSometimes(0.05); // for testing - LOG.debug(`g#${this.id}: fetch messages before ch#${channelId.slice(0, 4)}, mo#${messageOrderId}, ${number}`); + LOG.debug(`g#${this.id}: fetch messages before ch#${channelId.slice(0, 4)}, mo#${messageOrderId}, ${number}`); const members = await this.grabRAMMembersMap(); const channels = await this.grabRAMChannelsMap(); const messages = await this.fetchable.fetchMessagesBefore(channelId, messageOrderId, number); @@ -393,7 +391,7 @@ export default class CombinedGuild } async fetchMessagesAfter(channelId: string, messageOrderId: string, number: number): Promise { // xUtil.failSometimes(0.05); // for testing - LOG.debug(`g#${this.id}: fetch messages after ch#${channelId.slice(0, 4)}, mo#${messageOrderId}, ${number}`); + LOG.debug(`g#${this.id}: fetch messages after ch#${channelId.slice(0, 4)}, mo#${messageOrderId}, ${number}`); const members = await this.grabRAMMembersMap(); const channels = await this.grabRAMChannelsMap(); const messages = await this.fetchable.fetchMessagesAfter(channelId, messageOrderId, number); @@ -404,12 +402,12 @@ export default class CombinedGuild } async fetchResource(resourceId: string): Promise { // xUtil.failSometimes(0.05); // for testing - LOG.debug(`g#${this.id}: fetch resource r#${resourceId.slice(0, 4)}`); + LOG.debug(`g#${this.id}: fetch resource r#${resourceId.slice(0, 4)}`); return await this.fetchable.fetchResource(resourceId); } async fetchTokens(): Promise { // xUtil.failSometimes(0.05); // for testing - LOG.debug(`g#${this.id}: fetch tokens`); + LOG.debug(`g#${this.id}: fetch tokens`); const members = await this.grabRAMMembersMap(); const tokens = await this.fetchable.fetchTokens(); for (const token of tokens) {