Skip to content

Conversation

@JamyGolden
Copy link
Contributor

@JamyGolden JamyGolden commented Jul 13, 2023

What:

This fixes a bug where this.get('prev') returns undefined in some scenarios and the command this.get('prev').get('chainerId') throws an error since it's attempting to read get of undefined.

Why:

There is more information about this issue here: #248, but several people have commented that they are experiencing this. @matt-vendia responded with a solution on that issue, which solves the problem for me too (along with others who thumbs-upped the comment).

How:

Make sure this.get('prev') exists before assuming it's an object.

Checklist:

  • Documentation (n/a)
  • Tests (n/a)
  • Ready to be merged

This change is safe and small enough that it is ready to be merged imo.

Copy link

@leonardobumbeers leonardobumbeers left a comment

Choose a reason for hiding this comment

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

LGTM! I've faced the same issue when upgrading to version v9.0.0 and still occurs on version v10.0.0
@kentcdodds Could we include this PR in the next release?

name: queryName,
type:
this.get('prev').get('chainerId') === this.get('chainerId')
this.get('prev')?.get('chainerId') === this.get('chainerId')
Copy link
Member

Choose a reason for hiding this comment

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

I believe this does the same thing and is more terse :)

Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

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

Thanks!

@kentcdodds kentcdodds merged commit 063a2ff into testing-library:main Sep 13, 2023
@github-actions
Copy link

🎉 This PR is included in version 10.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@leonardobumbeers
Copy link

Thanks!

Thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4 participants