-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
feat: expiresAt should only update on sync in js package #2253
feat: expiresAt should only update on sync in js package #2253
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Ignored Deployments
|
Thank you for following the naming conventions for pull request titles! 🙏 |
packages/js/src/lib/initialize.tsThere are several instances where the same configuration object is being fetched multiple times within the same function. This can be improved by fetching the configuration once and reusing it. const currentConfig = config.get();
config.update({
environmentId: currentConfig.environmentId,
apiHost: currentConfig.apiHost,
userId: currentConfig.userId,
state: {
...currentConfig.state,
attributes: { ...currentConfig.state.attributes, ...c.attributes },
},
expiresAt: currentConfig.expiresAt,
});
packages/js/src/lib/person.tsSimilar to the previous suggestion, the configuration object is being fetched multiple times within the same function. This can be improved by fetching the configuration once and reusing it. const currentConfig = config.get();
config.update({
environmentId: currentConfig.environmentId,
apiHost: currentConfig.apiHost,
userId: currentConfig.userId,
state: {
...currentConfig.state,
attributes: {
...currentConfig.state.attributes,
[key]: value.toString(),
},
},
expiresAt: currentConfig.expiresAt,
});
|
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.
@ShubhamPalriwala thank you for this; looks great! :-)
What does this PR do?
the
expiresAt
now only gets updated when the sync happens with the Formbricks backend else it does not! Allowing for a much more updated client side data from the apiHow should this be tested?
Checklist
Required
pnpm build
console.logs
git pull origin main
Appreciated