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

Unversioned resource listings are truncated #896

Closed
victorlin opened this issue Jun 5, 2024 · 2 comments · Fixed by #897
Closed

Unversioned resource listings are truncated #896

victorlin opened this issue Jun 5, 2024 · 2 comments · Fixed by #897
Assignees
Labels
bug Something isn't working

Comments

@victorlin
Copy link
Member

victorlin commented Jun 5, 2024

Current Behavior

When setting versioned=false on ListResources, the resources entries are truncated.

image

Expected behavior

Resource entries should not be truncated.

image

How to reproduce

  1. Go to https://next.nextstrain.org/staging
  2. Observe bug

Scope

This was introduced in 54be4d6.

This affects /staging but not /pathogens. It may also affect work on #870 that uses unversioned resources.

Possible solution

Fix the condition here to not return w on lack of updateCadence:

export const getMaxResourceWidth = (displayResources: Resource[]) => {
return displayResources.reduce((w, r) => {
if (!r.displayName || !r.updateCadence) return w
/* add the pixels for the display name */
let _w = r.displayName.default.length * namePxPerChar;
if (r.nVersions) {
_w += gapSize + iconWidth;
_w += ((r.updateCadence.summary.length || 0) + 5 + String(r.nVersions).length)*summaryPxPerChar;
}
return _w>w ? _w : w;
}, 200); // 200 (pixels) is the minimum
}

@victorlin victorlin added the bug Something isn't working label Jun 5, 2024
@victorlin victorlin self-assigned this Jun 5, 2024
@jameshadfield
Copy link
Member

This doesn't affect /pathogens which is the only place where this component is used (as of now). It may affect work on #870 that uses unversioned resources.

the 🐛 is visible on https://next.nextstrain.org/staging

@victorlin victorlin mentioned this issue Jun 5, 2024
3 tasks
@victorlin
Copy link
Member Author

@jameshadfield oh I didn't realize ListResources was being used on staging with versioned=false, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants