Skip to content

Ensure latest notetype data is used after updates #18402

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Jun 4, 2025

Conversation

ShridharGoel
Copy link
Member

@ShridharGoel ShridharGoel commented May 31, 2025

Purpose / Description

Ensure latest notetype data is used after updates. This is done to fix an issue where old notes name was still showing while creating a card after updating a note type's name.

Fixes

Approach

The bug occurred because when a notetype was renamed via updateNotetype(), the old cached version with the original name remained in memory, causing UI components to show stale data until app restart.

With this new approach:

  • removeFromCache(specificId) removes the updated notetype from cache.
  • Next access to that notetype fetches fresh data from backend with new name.

How Has This Been Tested?

Manual testing + unit test.

Screen_recording_20250531_170034.webm

Checklist

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

Copy link
Member

@david-allison david-allison left a comment

Choose a reason for hiding this comment

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

Love the tests, thanks so much!

@david-allison david-allison added the Needs Second Approval Has one approval, one more approval to merge label May 31, 2025
@ShridharGoel ShridharGoel force-pushed the update-notes branch 2 times, most recently from f94cb6f to 5f91ff6 Compare June 1, 2025 09:07
@david-allison david-allison added the Needs Author Reply Waiting for a reply from the original author label Jun 2, 2025
Copy link
Member

@mikehardy mikehardy left a comment

Choose a reason for hiding this comment

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

LGTM

@mikehardy mikehardy enabled auto-merge June 4, 2025 00:34
@mikehardy mikehardy added Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) and removed Needs Author Reply Waiting for a reply from the original author Needs Second Approval Has one approval, one more approval to merge Has Conflicts labels Jun 4, 2025
@mikehardy mikehardy added this pull request to the merge queue Jun 4, 2025
Merged via the queue into ankidroid:main with commit a6c81e1 Jun 4, 2025
9 checks passed
@github-actions github-actions bot removed the Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) label Jun 4, 2025
@github-actions github-actions bot added this to the 2.21 release milestone Jun 4, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Renaming note types requires a restart
3 participants