You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe this is a bug caused by a stale data issue with SWR.
Steps:
Create an artifact of some type (such as a sheet)
Open it and make an edit, wait for it to save
Make a 2nd edit, wait for it to save
Click "View previous version", then "Restore this version" in the footer
Expected:
The previous version is restored
Actual:
Both edits are discarded, and document reverts to the first version (not the one that was visible on screen)
Note: This bug does NOT occur if you first focus on another window or tab, then return to the app's tab prior to clicking undo/restore (I think because SWR is revalidating on focus).
So the client is working from stale data when it decides which document versions to delete. Changing "revalidate" to true there fixes the issue, but I'm not sure why it was there in the first place so I don't know if this will cause other issues?
The text was updated successfully, but these errors were encountered:
I believe this is a bug caused by a stale data issue with SWR.
Steps:
Expected:
Actual:
Note: This bug does NOT occur if you first focus on another window or tab, then return to the app's tab prior to clicking undo/restore (I think because SWR is revalidating on focus).
I believe the issue is that "revalidate" is set to false when we save new document versions, on this line:
https://github.com/vercel/ai-chatbot/blob/main/components/artifact.tsx#L164
So the client is working from stale data when it decides which document versions to delete. Changing "revalidate" to true there fixes the issue, but I'm not sure why it was there in the first place so I don't know if this will cause other issues?
The text was updated successfully, but these errors were encountered: