Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Fixed Loss of Agent Data upon Login #991

Merged

Conversation

jasangill1
Copy link
Contributor

About

  • added the functionality to store agent data in the browser's local storage and retrieve it when returning to the login home page after login.

Technical Decisions:

  • Chosen to use the browser's localStorage API due to its simplicity and synchronicity.

#888

Demo.for.local.name.goal.stores.mp4

## About

- added the functionality to store agent data in the browser's local storage and retrieve it when when returning to the login home page after login

## Technical Decisions:

- Chosen to use the browser's localStorage API due to its simplicity and synchronicity.
@vercel
Copy link

vercel bot commented Jul 8, 2023

@jasangill1 is attempting to deploy a commit to the reworkd Team on Vercel.

A member of the Team first needs to authorize it.

@ergomake
Copy link

ergomake bot commented Jul 8, 2023

Hi 👋

Here's a preview environment 🚀

https://next-reworkd-agentgpt-991.env.ergomake.link

Environment Summary 📑

Container Source URL
next Dockerfile https://next-reworkd-agentgpt-991.env.ergomake.link
platform Dockerfile https://platform-reworkd-agentgpt-991.env.ergomake.link
db Dockerfile [not exposed - internal service]
weaviate semitechnologies/weaviate:1.19.6 https://weaviate-reworkd-agentgpt-991.env.ergomake.link

Questions? Comments? Suggestions? Join Discord.

Click here to disable Ergomake.

Comment on lines +125 to +145
const storeAgentDataInLocalStorage = (name: string, goal: string) => {
const agentData = { name, goal };
localStorage.setItem("agentData", JSON.stringify(agentData));
};

const getAgentDataFromLocalStorage = () => {
const agentData = localStorage.getItem("agentData");
return agentData ? JSON.parse(agentData) : null;
};

useEffect(() => {
if (session !== null) {
const agentData = getAgentDataFromLocalStorage();

if (agentData) {
setNameInput(agentData.name);
setGoalInput(agentData.goal);
localStorage.removeItem("agentData");
}
}
}, [session]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally we let this be done through a call back mechanism that would provide these values as query parameters. This solution seems ok for now, will merge tomorrow

@asim-shrestha asim-shrestha merged commit 0b46593 into reworkd:main Jul 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants