Skip to content

Replace mutex-based caching with suspendLazy for font bytes and codepoints, decode in Dispatchers.Default#911

Merged
egorikftp merged 1 commit intomainfrom
task/suspend-lazy
Feb 28, 2026
Merged

Replace mutex-based caching with suspendLazy for font bytes and codepoints, decode in Dispatchers.Default#911
egorikftp merged 1 commit intomainfrom
task/suspend-lazy

Conversation

@egorikftp
Copy link
Copy Markdown
Member


📝 Changelog

If this PR introduces user-facing changes, please update the relevant Unreleased section in changelogs:

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9e7b773 and 61402c7.

📒 Files selected for processing (5)
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/bootstrap/data/BootstrapRepository.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/boxicons/data/BoxIconsRepository.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/lucide/data/LucideRepository.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/remix/data/RemixRepository.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/util/coroutines/SuspendLazyProperty.kt

Walkthrough

This PR replaces Mutex-based manual caching with a new suspendLazy utility across four repository files. A new SuspendLazyProperty class is introduced, providing thread-safe lazy initialization for suspend functions using double-checked locking. BootstrapRepository, BoxIconsRepository, LucideRepository, and RemixRepository are refactored to use suspendLazy for caching font bytes and codepoints. RemixRepository additionally manages SVG metadata and version information through the new utility. Public API signatures remain mostly unchanged, with RemixRepository adding loadFontBytes() as a new public method. Explicit Mutex imports and synchronization blocks are removed from all repositories.

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description matches the template structure with the Changelog section present, but all checkboxes remain unchecked despite significant internal refactoring affecting the IntelliJ Plugin. Mark the IntelliJ Plugin checkbox as checked to indicate the architecture changes should be documented in the changelog.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: replacing mutex-based caching with suspendLazy and mentions the secondary objective of decoding in Dispatchers.Default.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch task/suspend-lazy

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@egorikftp egorikftp merged commit 44822c2 into main Feb 28, 2026
4 checks passed
@egorikftp egorikftp deleted the task/suspend-lazy branch February 28, 2026 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants