Skip to content

Commit

Permalink
fix: moved variable out of use-effect
Browse files Browse the repository at this point in the history
  • Loading branch information
malmen237 committed Jan 16, 2025
1 parent ea8cf8e commit f671367
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/landing-page/join-production.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export const JoinProduction = ({
const [isProgramOutputLine, setIsProgramOutputLine] = useState(false);

const { readFromStorage, writeToStorage } = useStorage();
const cachedUsername = readFromStorage("username");

const {
formState: { errors, isValid },
Expand Down Expand Up @@ -131,15 +132,14 @@ export const JoinProduction = ({

// Use local cache
useEffect(() => {
const cachedUsername = readFromStorage("username");
if (cachedUsername) {
setValue("username", cachedUsername);
}

if (addAdditionalCallId) {
setValue("productionId", addAdditionalCallId);
}
}, [addAdditionalCallId, readFromStorage, setValue]);
}, [addAdditionalCallId, cachedUsername, setValue]);

// If user selects a production from the productionlist
useEffect(() => {
Expand Down

0 comments on commit f671367

Please sign in to comment.