Skip to content

Commit

Permalink
[docs-infra] Prevent docs crash (#39214)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfauquette authored Oct 23, 2023
1 parent 1fd4dff commit a731e86
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions docs/src/modules/components/AppLayoutDocsFooter.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,13 @@ async function submitFeedback(page, rating, comment, language, commentedSection)
function getCurrentRating(pathname) {
let userFeedback;
if (typeof window !== 'undefined') {
userFeedback = getCookie('feedback');
userFeedback = userFeedback && JSON.parse(userFeedback);
try {
userFeedback = getCookie('feedback');
userFeedback = userFeedback && JSON.parse(userFeedback);
} catch {
// For unknown reason the `userFeedback` can be uncomplet, leading the JSON.parse to crash the entire docs
return undefined;
}
}
return userFeedback && userFeedback[pathname] && userFeedback[pathname].rating;
}
Expand Down

0 comments on commit a731e86

Please sign in to comment.