Skip to content

Add support for latest in query string#16

Merged
josevalim merged 2 commits intohexpm:mainfrom
ghivert:feat/use-latest-packages-when-undefined
Oct 23, 2025
Merged

Add support for latest in query string#16
josevalim merged 2 commits intohexpm:mainfrom
ghivert:feat/use-latest-packages-when-undefined

Conversation

@ghivert
Copy link
Collaborator

@ghivert ghivert commented Oct 22, 2025

Here is the support for latest in query string!
I let a comment to indicate where to put a loader if you want.

Fixes:

Error(_) -> #(package, version)
Ok(versions) -> {
case versions.releases {
[] -> #(package, version)
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps we should mark it as "not found" or something? Otherwise the version will be "latest" forever, which means the search never runs.

Suggested change
[] -> #(package, version)
[] -> #(package, "not found")

Copy link
Member

Choose a reason for hiding this comment

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

Actually, I think this branch is not possible. All packages will have at least one version... but I posted a comment above to add packages with zero versions, so we can mark them as "not found" (or alternatively as "0.0.0"). Otherwise the search never runs if one package fails.

versions: Loss(List(hexpm.Package)),
) -> #(Model, Effect(a)) {
case versions {
Error(_) -> #(model, toast.error("Server error. Retry later."))
Copy link
Member

@josevalim josevalim Oct 22, 2025

Choose a reason for hiding this comment

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

I think we need to mark that this package has no version in the error case. So we can go and mark it as not found later on. See comment below.

@josevalim
Copy link
Member

I wil remove the echo and tackle what is pending :D

@josevalim josevalim merged commit dbad929 into hexpm:main Oct 23, 2025
1 check passed
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

@ghivert
Copy link
Collaborator Author

ghivert commented Oct 23, 2025

I wil remove the echo and tackle what is pending :D

Thanks! 💜

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.

2 participants