Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Include default_version by default #10344

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

eth3lbert
Copy link
Contributor

This PR would ensure that default_version is included in the crate response by default. This eliminates the need to wait for the versions request to complete when default_version is the only version required. This also decouples requested version handling from versions.

Related:

@eth3lbert eth3lbert force-pushed the app-default-version branch from a03882a to ddfede2 Compare January 8, 2025 16:25
Comment on lines +70 to +76
/** @return {Map<string, import("../models/version").default>} */
@cached
get loadedVersionsByNum() {
let versionsRef = this.hasMany('versions');
let values = versionsRef.value();
return new Map(values?.map(ref => [ref.num, ref]));
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think versionsObj could also be changed to implement in this way. This would allow all versions that belong to this crate to be available, rather than just those loaded via the loadVersionsTask.

@eth3lbert
Copy link
Contributor Author

I have removed a commit that aimed to only await versions when needed. This commit fails in CI because we have some versions.length in the template, which would potentially load versions. I will address this in a separate PR, which will also require that the total number of versions be extracted from the meta.

app/adapters/crate.js Outdated Show resolved Hide resolved
app/adapters/version.js Show resolved Hide resolved
@eth3lbert eth3lbert force-pushed the app-default-version branch from ddfede2 to bfe8d72 Compare January 10, 2025 07:31
@eth3lbert
Copy link
Contributor Author

Rebased to make CI happy after the new Danger Zone was added :D

@eth3lbert eth3lbert force-pushed the app-default-version branch from bfe8d72 to 96786e2 Compare January 10, 2025 07:44
This commit would ensure that `default_version` is included in the
`crate` response by default. This eliminates the need to wait for the
`versions` request to complete when `default_version` is the only
version required.
Previously, we fetched all versions and then found the requested version
within them. This commit changes the approach to either retrieve the
version from loaded versions or fetch it from the endpoint. This change
allows us to migrate to paginated versions in the future.
@eth3lbert eth3lbert force-pushed the app-default-version branch from 96786e2 to 433abe7 Compare January 13, 2025 14:09
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