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

feat(javascript): add cache TTL and fix support message #2474

Merged
merged 5 commits into from
Jan 3, 2024

Conversation

shortcuts
Copy link
Member

🧭 What and Why

🎟 JIRA Ticket: https://algolia.atlassian.net/browse/DI-1741

closes #2470
closes #1489

Changes included:

this PR port changes from the v4 version:

  • add TTL to browser cache
  • fix contact support instructions

@shortcuts shortcuts self-assigned this Jan 3, 2024
@shortcuts shortcuts requested a review from a team as a code owner January 3, 2024 15:23
Copy link

netlify bot commented Jan 3, 2024

Deploy Preview for api-clients-automation ready!

Name Link
🔨 Latest commit 6853691
🔍 Latest deploy log https://app.netlify.com/sites/api-clients-automation/deploys/65959b018edbd50008352be3
😎 Deploy Preview https://deploy-preview-2474--api-clients-automation.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@algolia-bot
Copy link
Collaborator

algolia-bot commented Jan 3, 2024

✗ The generated branch has been deleted.

If the PR has been merged, you can check the generated code on the main branch.
You can still access the code generated on main via this commit.

Copy link
Collaborator

@millotp millotp left a comment

Choose a reason for hiding this comment

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

🧹

Object.entries(filteredNamespaceWithoutOldFormattedCacheItems).filter(
([, cacheItem]) => {
const currentTimestamp = new Date().getTime();
const isExpired = cacheItem.timestamp + timeToLive < currentTimestamp;
Copy link
Collaborator

Choose a reason for hiding this comment

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

what happens when timeToLive is null ? shouldn't you just early return instead of doing the addition here ?

Copy link
Member Author

Choose a reason for hiding this comment

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

those are already filtered

I did not touched the actual implementation just in case we broke something non tested

Copy link
Collaborator

Choose a reason for hiding this comment

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

oh yeah it's just above I missed it

@shortcuts shortcuts requested a review from millotp January 3, 2024 16:45
@shortcuts shortcuts enabled auto-merge (squash) January 3, 2024 17:36
@shortcuts shortcuts merged commit 4546090 into main Jan 3, 2024
17 of 18 checks passed
@shortcuts shortcuts deleted the feat/js-v4-changes branch January 3, 2024 17:40
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.

fix: support message feat(javascript): TTL to browser cache
3 participants