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

fix: fixed crash on list contributor grid when in card view changing page size #2241

Merged
merged 3 commits into from
Dec 1, 2023

Conversation

nickytonline
Copy link
Member

@nickytonline nickytonline commented Dec 1, 2023

Description

I've added react-error-boundary to the project that allows us to catch errors at the component level and display a fallback component if an error does occur.

Aside from that, it appears the initial contributor list data was causing issues with the component. This was working before, so not sure why removing it now fixes the issue, but as we get larger lists of contributors, it makes sense to offload this to the client-side only, much like the fix in #2215.

What type of PR is this? (check all applicable)

  • 🍕 Feature
  • 🐛 Bug Fix
  • 📝 Documentation Update
  • 🎨 Style
  • 🧑‍💻 Code Refactor
  • 🔥 Performance Improvements
  • ✅ Test
  • 🤖 Build
  • 🔁 CI
  • 📦 Chore (Release)
  • ⏩ Revert

Related Tickets & Documents

Fixes #2240

Mobile & Desktop Screenshots/Recordings

Before

The before view is running the dev server which is why you get the detailed error. If it was production, it would be the classic Next.js black screen of death.

CleanShot.2023-11-30.at.22.14.30.mp4

After

CleanShot.2023-11-30.at.19.55.42.mp4

Added tests?

  • 👍 yes
  • 🙅 no, because they aren't needed
  • 🙋 no, because I need help

Added to documentation?

  • 📜 README.md
  • 📓 docs.opensauced.pizza
  • 🍕 dev.to/opensauced
  • 📕 storybook
  • 🙅 no documentation needed

[optional] Are there any post-deployment tasks we need to perform?

[optional] What gif best describes this PR or how it makes you feel?

Copy link

netlify bot commented Dec 1, 2023

Deploy Preview for oss-insights ready!

Name Link
🔨 Latest commit 943aad8
🔍 Latest deploy log https://app.netlify.com/sites/oss-insights/deploys/65692e2086fb9900079b3d42
😎 Deploy Preview https://deploy-preview-2241--oss-insights.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@nickytonline nickytonline requested a review from OgDev-01 December 1, 2023 00:51
Copy link

netlify bot commented Dec 1, 2023

Deploy Preview for design-insights ready!

Name Link
🔨 Latest commit 943aad8
🔍 Latest deploy log https://app.netlify.com/sites/design-insights/deploys/65692e20df3a140008eb0b9c
😎 Deploy Preview https://deploy-preview-2241--design-insights.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@@ -97,6 +97,7 @@
"react-day-picker": "^8.7.1",
"react-dom": "^18.2.0",
"react-emoji-render": "^2.0.1",
"react-error-boundary": "^4.0.11",
Copy link
Member Author

Choose a reason for hiding this comment

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

react-error-boundary will allow us to have a fallback view if we wrap a component with it that crashes.

}),
fetchApiData<DBList>({ path: `lists/${listId}`, bearerToken, pathValidator: validateListPath }),
]);
const { data: list, error } = await fetchApiData<DBList>({
Copy link
Member Author

Choose a reason for hiding this comment

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

I've removed server-side rendering contributor list data and only kept critical stuff to load the page, e.g. list info.

Something related to the initial data for the contributor list is what caused the issue with the card view. Still trying to work out why, but regardless it makes sense to only load this client-side going forward as mentioned in the PR description.

range={String(range) ?? "30"}
/>
<ErrorBoundary
fallback={<div className="grid place-content-center">Error loading the list of contributors</div>}
Copy link
Member Author

@nickytonline nickytonline Dec 1, 2023

Choose a reason for hiding this comment

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

I went with a barebones fallback error message @isabensusan, but going forward a bit of styling for this would be nice as we can use this for graphs or other data driven components. It can be in another PR though.

@nickytonline nickytonline marked this pull request as draft December 1, 2023 00:59
@nickytonline nickytonline changed the title fix: no more crash on list contributor grid when in card view changing page size fix: fixed crash on list contributor grid when in card view changing page size Dec 1, 2023
@nickytonline nickytonline marked this pull request as ready for review December 1, 2023 03:15
@nickytonline nickytonline requested a review from a team December 1, 2023 04:14
Copy link
Contributor

@OgDev-01 OgDev-01 left a comment

Choose a reason for hiding this comment

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

LGTM codewise 👍

@brandonroberts brandonroberts merged commit f6bc793 into beta Dec 1, 2023
47 checks passed
@brandonroberts brandonroberts deleted the nickytonline/fix-for-2240 branch December 1, 2023 14:02
open-sauced bot pushed a commit that referenced this pull request Dec 1, 2023
### [1.78.1-beta.1](v1.78.0...v1.78.1-beta.1) (2023-12-01)

### 🐛 Bug Fixes

* fixed crash on list contributor grid when in card view changing page size ([#2241](#2241)) ([f6bc793](f6bc793))
open-sauced bot pushed a commit that referenced this pull request Dec 5, 2023
## [1.79.0](v1.78.0...v1.79.0) (2023-12-05)

### 🍕 Features

* upgraded to Storybook 7.6.3 ([#2244](#2244)) ([a2ae11a](a2ae11a))

### 🐛 Bug Fixes

* fixed crash on list contributor grid when in card view changing page size ([#2241](#2241)) ([f6bc793](f6bc793))
* now most used languages are truncated to a limit of two ([#2238](#2238)) ([97ce66e](97ce66e))
* now the highlight input form closes only if you press ESC or click the close button ([e56ea73](e56ea73))
* now the highlight input form closes only if you press ESC or click the close button ([#2257](#2257)) ([1b94421](1b94421))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants