Skip to content

Commit

Permalink
fix: chain paths handle errors
Browse files Browse the repository at this point in the history
  • Loading branch information
0xtiti committed Sep 4, 2024
1 parent b7d47e4 commit 5510767
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/navigation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ describe('Navigation tests', () => {

cy.getByTestId('search-bar').find('input').type('324');
cy.getByTestId('chain-row').should('be.visible').click();
cy.url().should('include', '/324');

cy.getByTestId('chain-id').should('be.visible').and('contain', '324');
cy.url().should('include', '/324');

cy.getByTestId('home-breadcrumb').click();
cy.url().should('eq', 'http://localhost:5173/');
Expand Down
14 changes: 12 additions & 2 deletions src/pages/[chain]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,18 @@ export const getStaticPaths: GetStaticPaths = async () => {
};
}

const ecosystemData = await fetchEcosystemData();
const chains = ecosystemData.zkChains;
let ecosystemData;
try {
ecosystemData = await fetchEcosystemData();
} catch (error) {
console.error('Failed to fetch ecosystem data:', error);
return {
paths: [],
fallback: true,
};
}

const chains = ecosystemData.zkChains || [];

const paths = SUPPORTED_LANGUAGES.flatMap((locale) =>
chains.map((chain: EcosystemChainData) => ({
Expand Down

0 comments on commit 5510767

Please sign in to comment.