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

Addon Test: Handle undefined storyId #29998

Merged
merged 2 commits into from
Dec 10, 2024
Merged

Addon Test: Handle undefined storyId #29998

merged 2 commits into from
Dec 10, 2024

Conversation

ghengeveld
Copy link
Member

@ghengeveld ghengeveld commented Dec 10, 2024

What I did

Fixes a "cannot read property of undefined" error.

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli-storybook/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>

name before after diff z %
createSize 0 B 0 B 0 B - -
generateSize 77.7 MB 77.7 MB 1.48 kB -0.3 0%
initSize 133 MB 133 MB 8.66 kB 2.98 0%
diffSize 55.1 MB 55.1 MB 7.18 kB 2.96 0%
buildSize 6.87 MB 6.87 MB 3.78 kB 1.23 0.1%
buildSbAddonsSize 1.51 MB 1.51 MB 219 B 3.33 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 1.86 MB 1.86 MB 2.31 kB 19.19 0.1%
buildSbPreviewSize 0 B 0 B 0 B - -
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 3.57 MB 3.57 MB 2.52 kB 6.13 0.1%
buildPreviewSize 3.3 MB 3.3 MB 1.25 kB 1.15 0%
testBuildSize 0 B 0 B 0 B - -
testBuildSbAddonsSize 0 B 0 B 0 B - -
testBuildSbCommonSize 0 B 0 B 0 B - -
testBuildSbManagerSize 0 B 0 B 0 B - -
testBuildSbPreviewSize 0 B 0 B 0 B - -
testBuildStaticSize 0 B 0 B 0 B - -
testBuildPrebuildSize 0 B 0 B 0 B - -
testBuildPreviewSize 0 B 0 B 0 B - -
name before after diff z %
createTime 7.4s 9s 1.6s -0.26 18%
generateTime 21.5s 28.3s 6.8s 4.36 🔺24%
initTime 13.5s 16.4s 2.8s 2.44 🔺17.6%
buildTime 8.3s 9s 633ms 0.28 7%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 5.7s 4.1s -1s -614ms -1.62 🔰-39.2%
devManagerResponsive 4.2s 3.1s -1s -149ms -1.59 🔰-36.9%
devManagerHeaderVisible 576ms 472ms -104ms -1.48 🔰-22%
devManagerIndexVisible 677ms 478ms -199ms -1.8 🔰-41.6%
devStoryVisibleUncached 1.9s 1.7s -218ms -0.07 -12.6%
devStoryVisible 673ms 498ms -175ms -1.6 🔰-35.1%
devAutodocsVisible 686ms 424ms -262ms -1.35 🔰-61.8%
devMDXVisible 562ms 406ms -156ms -1.46 🔰-38.4%
buildManagerHeaderVisible 748ms 467ms -281ms -1.23 -60.2%
buildManagerIndexVisible 757ms 553ms -204ms -1.13 -36.9%
buildStoryVisible 596ms 433ms -163ms -1.21 -37.6%
buildAutodocsVisible 426ms 376ms -50ms -1.24 🔰-13.3%
buildMDXVisible 510ms 374ms -136ms -1.28 🔰-36.4%

Greptile Summary

Added optional chaining to handle undefined storyId values in the TestProviderRender component, preventing "cannot read property of undefined" errors when filtering test results.

  • Added optional chaining in code/addons/test/src/components/TestProviderRender.tsx for result.storyId?.startsWith() checks
  • Improved null safety when filtering test results for both component and accessibility tests
  • Standardized handling of undefined values across status mapping and result sorting
  • Ensured consistent error handling between a11y and component test result processing

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

LGTM

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

Copy link

nx-cloud bot commented Dec 10, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 26838bf. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

@ghengeveld ghengeveld merged commit 171304c into next Dec 10, 2024
57 of 58 checks passed
@ghengeveld ghengeveld deleted the fix-undefined branch December 10, 2024 11:40
@github-actions github-actions bot mentioned this pull request Dec 10, 2024
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants