Skip to content

Commit

Permalink
Fallback to latest version if unknown version is passed
Browse files Browse the repository at this point in the history
  • Loading branch information
AbrilRBS committed Dec 16, 2024
1 parent 25e5289 commit 39e1321
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions conanio/pages/center/recipes/[recipeName].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,12 @@ const ConanPackage: NextPage<PageProps> = (props) => {

useEffect(() => {hljs.highlightAll();});

const [selectedVersion, setSelectedVersion] = useState(props.recipeVersion !== null? props.recipeVersion: props.data[0].info.version);
const indexSelectedVersion = Object.keys(props.data).filter(index => props.data[index].info.version === selectedVersion)[0];
let [selectedVersion, setSelectedVersion] = useState(props.recipeVersion !== null? props.recipeVersion: props.data[0].info.version);
let indexSelectedVersion = Object.keys(props.data).filter(index => props.data[index].info.version === selectedVersion)[0];
if (indexSelectedVersion == null) {
indexSelectedVersion = "0";
selectedVersion = props.data[0].info.version;
}
const isTabletOrMobile = useMediaQuery({ query: '(max-width: 1224px)' })
const [selectedTab, setSelectedTab] = useState(indexSelectedVersion && props.data[indexSelectedVersion].info.status === "ok"? 'use_it': 'versions');
const [packageOS, setPackageOS] = useState(null);
Expand Down

0 comments on commit 39e1321

Please sign in to comment.