fix calltimer resetting (#1060)

This commit is contained in:
creations 2026-05-08 11:59:22 -04:00 • committed by GitHub
parent 43c3682e3e
commit 96d4c9e2bd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -7,7 +7,7 @@
import { definePluginSettings } from "@api/Settings";
import ErrorBoundary from "@components/ErrorBoundary";
import { Devs, EquicordDevs } from "@utils/constants";
import { useTimer } from "@utils/react";
import { useFixedTimer } from "@utils/react";
import { formatDurationMs } from "@utils/text";
import definePlugin, { OptionType } from "@utils/types";
import { PassiveUpdateState, VoiceState } from "@vencord/discord-types";
@ -264,16 +264,17 @@ export default definePlugin({
);
},
renderConnectionTimer(channelId: string) {
renderConnectionTimer({ channelId }: { channelId: string | undefined; }) {
return <ErrorBoundary noop>
<this.ConnectionTimer channelId={channelId} />
</ErrorBoundary>;
},
ConnectionTimer: ErrorBoundary.wrap(({ channelId }: { channelId: string; }) => {
const time = useTimer({
deps: [channelId]
});
ConnectionTimer: ErrorBoundary.wrap((_: { channelId: string | undefined; }) => {
const joinTime = userJoinTimes.get(UserStore.getCurrentUser().id)?.time;
const time = useFixedTimer({ initialTime: joinTime });
if (joinTime == null) return null;
return (
<p style={{ margin: 0, fontFamily: "var(--font-code)" }}>