Skip to content

Conversation

@pan-kot
Copy link
Member

@pan-kot pan-kot commented Oct 16, 2025

The onError callback needed for error boundaries (see [R0opA8eVEt6T]) should not use the event handler abstraction. It needs to therefore be exempted from the existing rule that requires event handler type for all callback that start from "on".

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@pan-kot pan-kot requested a review from a team as a code owner October 16, 2025 12:20
@pan-kot pan-kot requested review from georgylobko and removed request for a team October 16, 2025 12:20
@codecov
Copy link

codecov bot commented Oct 16, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.69%. Comparing base (38a0914) to head (c3e1dc7).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #98      +/-   ##
==========================================
+ Coverage   96.65%   96.69%   +0.03%     
==========================================
  Files          11       11              
  Lines         838      846       +8     
  Branches      281      284       +3     
==========================================
+ Hits          810      818       +8     
  Misses         28       28              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

): ComponentDefinition {
const regions = props.filter(prop => prop.type === 'React.ReactNode');
const events = props.filter(prop => prop.name.match(/^on[A-Z]/));
const events = props.filter(prop => prop.name.match(/^on[A-Z]/) && prop.name !== 'onError');
Copy link
Member

Choose a reason for hiding this comment

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

Why such fundamental change instead of simply using a different name in that API, reportError for example?

Copy link
Member Author

Choose a reason for hiding this comment

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

The onError is used by the react-error-boundary and an internal package, so the teams are familiar with that one already.

Copy link
Member

Choose a reason for hiding this comment

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

This breaks an existing convention of our components that people are familiar with as well.

Breaking the components naming convention needs a separate discussion. The PR is on hold for now.

Copy link
Member Author

Choose a reason for hiding this comment

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

The error boundary is not a typical component either, but I am happy to discuss it.

@pan-kot pan-kot requested a review from just-boris October 20, 2025 06:35
@just-boris just-boris removed their request for review October 20, 2025 08:41
import { describe, expect, test } from 'vitest';
import { buildProject } from './test-helpers';

describe('Error boundary', () => {
Copy link
Member

Choose a reason for hiding this comment

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

I'd suggest adding a test for the onError behavior. You could trigger a condition that causes onError to be called and then verify it with toHaveBeenCalledWith

Copy link
Member Author

Choose a reason for hiding this comment

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

The changes here validate that the onError is added to the generated documentation (validated with the snapshot test), but the actual error boundary implementation is here: cloudscape-design/components#3736, and it does include the coverage on the onError behaviour.

@pan-kot pan-kot added this pull request to the merge queue Oct 20, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 20, 2025
@pan-kot pan-kot added this pull request to the merge queue Oct 20, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 20, 2025
@pan-kot pan-kot added this pull request to the merge queue Oct 21, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 21, 2025
@pan-kot pan-kot added this pull request to the merge queue Oct 21, 2025
Merged via the queue into main with commit 525b32b Oct 21, 2025
42 checks passed
@pan-kot pan-kot deleted the feat-allow-on-error-special-callback branch October 21, 2025 15:12
mariksav pushed a commit to mariksav/documenter that referenced this pull request Oct 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants