Skip to content

Commit

Permalink
Fix dependency issue
Browse files Browse the repository at this point in the history
  • Loading branch information
pdelfan committed Dec 13, 2023
1 parent ee60bcd commit 4ef2f2a
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/lib/hooks/bsky/useAgent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { useRouter } from "next/navigation";
import { createAgent } from "@/lib/api/bsky/agent";

export default function useAgent() {
const at = createAgent();
const [agent, setAgent] = useState(at);
const [agent, setAgent] = useState(createAgent());
const { data: session, status } = useSession();
const router = useRouter();

Expand All @@ -18,12 +17,11 @@ export default function useAgent() {

const getAgent = async () => {
const bskySession = session.user.bskySession;
at.session = bskySession;
setAgent(at);
agent.session = bskySession;
};

getAgent();
}, [at, router, session?.user.bskySession, status]);
}, [agent, router, session?.user.bskySession, status]);

return agent;
}
}

0 comments on commit 4ef2f2a

Please sign in to comment.