Repository navigation
Fetch icons a stale cached set lacks, and scan Markdown - #3
Merged
Merged
Conversation
A set cached before an icon was added made new icons fail with Icon not found. Icons missing from the cached set are now fetched one by one from the Iconify API, which also reports unknown names instead of raising. Markdown files matched by the default globs were skipped; they are now scanned like HEEx. Closes #2.
…ests Default globs include Astral templates and Markdown only when Astral is a dependency. The get_icons tests move into cache_test.exs, and an e2e test against the Iconify API, run with mix test.e2e, reproduces #2. Requires iconify 0.3.1, which reports unknown names instead of raising.
Member
Author
|
Updated:
Against the fixed iconify ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2.
Cause.
Cache.fetch_set/1always prefers the copy of a set cached inpriv/iconify/sets/. If that copy was downloaded before an icon was added to the collection, the compiler reports "Icon not found" and never refetches. That's whylucide:layer-arrow-upfailed whileIconify.Fetcher.fetch_icon/2worked: a fresh Lucide set (1,929 icons) has it.Fix.
PhoenixIconify.Cache.get_icons/3takes icons from the cached set and fetches whatever it lacks one by one from the Iconify API. The compiler uses it.Iconify.Fetcher.fetch_icons/2raised on them throughSet.get!.content/**/*.mdto the default globs, butscan_file/1skipped them, so icons in Astral Markdown neededextra_icons. Markdown goes through the HEEx scanner, which already falls back to line-by-line parsing when a file isn't valid HEEx.Tests. A stale cached set test covers the issue's case with a fake fetcher (cached icon, icon only in the API, and an icon that exists nowhere). A Markdown test has an icon next to a code block containing
<.mix cipasses (32 tests).