Skip to content

Fetch icons a stale cached set lacks, and scan Markdown - #3

Merged
dannote merged 3 commits into
masterfrom
fix/stale-cached-sets
Oct 1, 2026
Merged

dannote merged 3 commits into
masterfrom
fix/stale-cached-sets

Conversation

@dannote

@dannote dannote commented Oct 1, 2026

Copy link
Copy Markdown
Member

Fixes #2.

Cause. Cache.fetch_set/1 always prefers the copy of a set cached in priv/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 why lucide:layer-arrow-up failed while Iconify.Fetcher.fetch_icon/2 worked: a fresh Lucide set (1,929 icons) has it.

Fix.

  • PhoenixIconify.Cache.get_icons/3 takes icons from the cached set and fetches whatever it lacks one by one from the Iconify API. The compiler uses it.
  • Unknown names are now reported as not found. Before, the batched Iconify.Fetcher.fetch_icons/2 raised on them through Set.get!.
  • Markdown files are now scanned too. v0.3.5 added content/**/*.md to the default globs, but scan_file/1 skipped them, so icons in Astral Markdown needed extra_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 ci passes (32 tests).

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.
@dannote

dannote commented Oct 1, 2026

Copy link
Copy Markdown
Member Author

Updated:

  • Markdown only with Astral. The default globs include Astral templates and Markdown (pages/**/*.{astral,md}, components/, layouts/, content/**/*.md) only when Astral is a dependency. Other projects scan just their Phoenix sources.
  • Tests mirror lib/. The get_icons/3 tests now live in cache_test.exs.
  • End-to-end tests are separate. test/e2e/phoenix_iconify/cache_test.exs reproduces New Lucide icons #2 against the real Iconify API. It's tagged :e2e, excluded from mix test, and runs with mix test.e2e.
  • Needs iconify 0.3.1 (Leave unknown names out of fetch_icons instead of raising iconify#1). The e2e test showed that Iconify.Fetcher.fetch_icon/2 raised on unknown names. That's fixed in iconify, and this PR now requires ~> 0.3.1. Its dependencies resolve once that's published.

Against the fixed iconify (ICONIFY_PATH), mix test passes (34 tests) and so does mix test.e2e.

@dannote
dannote merged commit e3f0512 into master Oct 1, 2026
2 checks passed
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.

New Lucide icons

1 participant