Skip to content

Commit

Permalink
fix(nui): empty player modal when using tx chat command with id
Browse files Browse the repository at this point in the history
  • Loading branch information
tabarra committed Oct 1, 2024
1 parent eb77a34 commit 3353f2d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/dev_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ Legend:
- [x] the WarningBar scrolls up with the pages when they have scroll
- [x] fix the message `Since this is not a critical file, ...` on first boot without txData
- from `SvRuntimeStatsManager` and `PlayerDropStatsManager` + persistent cache
- [x] fix: doing /tx <disconnected id> shows empty modal
- [!] fix the spam of `[tx:WebServer:AuthMws] Invalid session auth: admin_not_found`
- [!] fix: doing /tx <disconnected id> shows empty modal
- [ ] fix: `server partial hang detected` should not be the error for `(HB:0HC:--)`
- [ ] fix txDiagnostics (and add tx v8 heap data to it)

Expand Down
8 changes: 6 additions & 2 deletions nui/src/hooks/useHudListenersService.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { txAdminMenuPage, useSetPage } from "../state/page.state";
import { useAnnounceNotiPosValue } from "../state/server.state";
import { useSetPlayerModalVisibility } from "@nui/src/state/playerModal.state";
import cleanPlayerName from "@shared/cleanPlayerName";
import { usePlayerModalContext } from "../provider/PlayerModalProvider";

type SnackbarAlertSeverities = "success" | "error" | "warning" | "info";

Expand Down Expand Up @@ -76,6 +77,7 @@ export const useHudListenersService = () => {
const setPlayersFilterIsTemp = useSetPlayersFilterIsTemp();
const setPage = useSetPage();
const notiPos = useAnnounceNotiPosValue();
const { closeMenu } = usePlayerModalContext();

const snackFormat = (m: string) => (
<span style={{ whiteSpace: "pre-wrap" }}>{m}</span>
Expand Down Expand Up @@ -164,15 +166,17 @@ export const useHudListenersService = () => {
}

if (targetPlayer) {
setPage(txAdminMenuPage.Players);
setPage(txAdminMenuPage.Main);
setAssocPlayer(targetPlayer);
setModalOpen(true);
} else {
closeMenu();
setModalOpen(false);
enqueueSnackbar(
t("nui_menu.player_modal.misc.target_not_found", { target }),
{ variant: "error" }
);
}
setModalOpen(true);
});

useNuiEvent<AddAnnounceData>("addAnnounceMessage", ({ message, author }) => {
Expand Down

0 comments on commit 3353f2d

Please sign in to comment.