Skip to content

Commit

Permalink
Fix picklists overwriting before they load
Browse files Browse the repository at this point in the history
  • Loading branch information
renatodellosso committed Feb 17, 2025
1 parent 3d3bf31 commit 8b29ceb
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions components/stats/Picklist.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import {
const SHOW_PICKLISTS_ON_TEAM_CARDS = false;
const SHOW_CARD_IDS = false;

const api = new ClientApi();

function TeamCard(props: {
entry: PicklistEntry;
draggable: boolean;
Expand Down Expand Up @@ -297,8 +299,6 @@ export function TeamList(props: {
);
}

const api = new ClientApi();

export default function PicklistScreen(props: {
teams: number[];
reports: Report[];
Expand All @@ -321,10 +321,10 @@ export default function PicklistScreen(props: {
const teams = props.teams.map((team) => ({ number: team }));

// Save picklists
useEffect(
() => savePicklistGroup(props.picklist._id, picklists, strikethroughs, api),
[props.picklist._id, picklists, strikethroughs],
);
useEffect(() => {
if (loadingPicklists !== LoadState.Loaded) return;
savePicklistGroup(props.picklist._id, picklists, strikethroughs, api);
}, [props.picklist._id, picklists, strikethroughs]);

const updatePicklist = useCallback(
(picklist: Picklist) => {
Expand Down

0 comments on commit 8b29ceb

Please sign in to comment.