-
Notifications
You must be signed in to change notification settings - Fork 4
feat: clear translation cache #39
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
base: main
Are you sure you want to change the base?
Conversation
@ameeetgaikwad is attempting to deploy a commit to the JigsawStack Team on Vercel. A member of the Team first needs to authorize it. |
@@ -1039,4 +1040,17 @@ if (typeof window !== "undefined") { | |||
}; | |||
} | |||
}; | |||
|
|||
window.clearCache = ( | |||
onComplete?: () => void, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, the clear() function removes all cached translations from localStorage. I’d like to add an optional lang_code parameter—if provided, it should only clear the cache for that specific language. If not provided, it should continue to clear everything as before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alright will add this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added this as well.
just one thing, when clearing cache for specific language it doesn't clear jss-pref
. Let me know if u want to clear this as well.
This PR exposes the existing cache clearing functionality through the global API, making it easily accessible to widget users. Users can now manually trigger clearing cache.