Skip to content

Commit

Permalink
Fix updating draft lottery table after game sim during regular season
Browse files Browse the repository at this point in the history
  • Loading branch information
dumbmatter committed Mar 18, 2024
1 parent 637795e commit 9f352a2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 1 addition & 3 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
dialog still in DOM after closing, why?

draft lottery UI
- test updating as games are played
- happened after last dep upgrade

arrow navigation between players on team https://old.reddit.com/r/BasketballGM/comments/1afy7ba/monthly_suggestions_thread/kr9whzi/
- make it a select? or listen for keyboard shortcut?
Expand Down
12 changes: 9 additions & 3 deletions src/ui/views/DraftLottery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type State = {
type Action =
| {
type: "init";
props: Props;
props: Pick<Props, "result" | "season" | "draftType">;
}
| {
type: "startClicked";
Expand Down Expand Up @@ -295,6 +295,7 @@ const Rigged = ({
};

const DraftLotteryTable = (props: Props) => {
console.log("render table", props.result);
const isMounted = useRef(true);
useEffect(() => {
return () => {
Expand All @@ -317,10 +318,15 @@ const DraftLotteryTable = (props: Props) => {
season: props.season,
});

if (props.season !== state.season) {
// Handle changing season, and updating state.result due to game sim
if (
props.season !== state.season ||
props.draftType !== state.draftType ||
(revealState.current === "init" && props.result !== state.result)
) {
numLeftToReveal.current = 0;
revealState.current = "init";
dispatch({ type: "init", props: props });
dispatch({ type: "init", props });
}

const revealPickAuto = () => {
Expand Down

0 comments on commit 9f352a2

Please sign in to comment.