Skip to content

Conversation

@lukebars
Copy link
Contributor

@lukebars lukebars commented Jan 7, 2026

Description

Starting September 5th, 2025 Toggl Track introduced API limits. Most of the users are using free plan, or starting premium plan which has very low API limits.

I've added cache utilisation to prevent menu bar from hitting the API limit as soon as it starts. Increased default cache time to 240 seconds. It is still configurable in the extension settings for those who want faster refresh rates. Right now the extension's menu bar function is finally usable again.

Checklist

@raycastbot raycastbot added extension fix / improvement Label for PRs with extension's fix improvements extension: toggl-track Issues related to the toggl-track extension platform: macOS platform: Windows OP is contributor The OP of the PR is a contributor of the extension labels Jan 7, 2026
@raycastbot
Copy link
Collaborator

raycastbot commented Jan 7, 2026

Thank you for your contribution! 🎉

🔔 @franzwilhelm @bkeys818 @michaelfaisst @teziovsky @tangerine1202 @AlexIsMaking @ARui-tw @pernielsentikaer @AdrianKokot @xmok you might want to have a look.

You can use this guide to learn how to check out the Pull Request locally in order to test it.

📋 Quick checkout commands
BRANCH="main"
FORK_URL="https://github.com/lukebars/raycast-extensions.git"
EXTENSION_NAME="toggl-track"
REPO_NAME="raycast-extensions"

git clone -n --depth=1 --filter=tree:0 -b $BRANCH $FORK_URL
cd $REPO_NAME
git sparse-checkout set --no-cone "extensions/$EXTENSION_NAME"
git checkout
cd "extensions/$EXTENSION_NAME"
npm install && npm run dev

Due to our current reduced availability, the initial review may take up to 10-15 business days.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 7, 2026

Greptile Summary

  • Implements caching for Toggl Track API requests to prevent hitting the new rate limits (30 requests/hour for free tier) introduced in September 2025
  • Updates default cache TTL from 0 to 240 seconds with configurable settings to keep MenuBar functionality within API limits
  • Adds invalidateTimeEntriesCache() calls throughout the application after time entry mutations (create, update, delete, stop) to maintain data consistency

Important Files Changed

Filename Overview
extensions/toggl-track/src/api/timeEntries.ts Wraps API calls with caching but uses static cache keys that don't account for different date ranges or parameters
extensions/toggl-track/package.json Updates default cache TTL preference from 0 to 240 seconds and provides clear API limit guidance

Confidence score: 2/5

  • This PR addresses a critical usability issue but has a significant caching implementation flaw that could cause data inconsistency
  • Score lowered due to static cache keys in timeEntries.ts that don't differentiate between different date ranges and API parameters, potentially returning stale data for different queries
  • Pay close attention to extensions/toggl-track/src/api/timeEntries.ts which needs cache key fixes to prevent incorrect data being served across different date ranges

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Additional Comments (2)

  1. extensions/toggl-track/src/api/timeEntries.ts, line 14-19 (link)

    logic: Cache key 'timeEntries' ignores function parameters (startDate, endDate, includeMetadata). Different date ranges will return stale cached data instead of fresh results. Consider using a dynamic cache key like timeEntries-${startDate.toISOString()}-${endDate.toISOString()}-${includeMetadata}

  2. extensions/toggl-track/CHANGELOG.md, line 3 (link)

    syntax: The date should use the placeholder {PR_MERGE_DATE} instead of a specific date

    Context Used: Rule from dashboard - What: Changelog entries must use {PR_MERGE_DATE} placeholder in titles, be placed at the top of th... (source)

10 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

@0xdhrv
Copy link
Contributor

0xdhrv commented Jan 8, 2026

Hi 👋

Thanks for your contribution 💪

Could you look into the suggestions from Greptile related to the cache key update?

I'm looking forward to testing this extension again 🔥

I converted this PR into a draft until it's ready for the review, please press the button Ready for review when it's ready and we'll have a look 😊

Feel free to contact me here or at Slack if you have any questions.

@0xdhrv 0xdhrv marked this pull request as draft January 8, 2026 06:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extension fix / improvement Label for PRs with extension's fix improvements extension: toggl-track Issues related to the toggl-track extension OP is contributor The OP of the PR is a contributor of the extension platform: macOS platform: Windows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants