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

Compiled code seems broken #58

Closed
bvaughn opened this issue Sep 13, 2018 · 6 comments
Closed

Compiled code seems broken #58

bvaughn opened this issue Sep 13, 2018 · 6 comments
Labels
😭 bug Something isn't working

Comments

@bvaughn
Copy link
Owner

bvaughn commented Sep 13, 2018

Calling e.g. ref.current.resetAfterColumnIndex() on VariableSizeGrid seems to trigger a runtime error.

Resize the window of this Code Sandbox to repro: https://codesandbox.io/s/5ywr9ro7nn

It looks like the this context is getting messed up somehow. (this is valid but _this is undefined.)

@bvaughn bvaughn added the 😭 bug Something isn't working label Sep 13, 2018
@TrySound
Copy link
Contributor

This doesn't look like a bug in compiled code. I see you use this inside of initInstanceProps which is not called with any instance. Arrow functions of course doesn't have own context.

@TrySound
Copy link
Contributor

Use instance instead of this.

@bvaughn
Copy link
Owner Author

bvaughn commented Sep 13, 2018

Didn't have time to dig into the underlying cause, just noted that the compiled code was referencing the wrong thing and wanted to leave a note for myself to fix later (or you if you beat me to it 😉)

@TrySound
Copy link
Contributor

Seems like you didn't covered this case with tests. This code doesn't look correct.
https://github.com/bvaughn/react-window/blob/master/src/VariableSizeGrid.js#L406

@TrySound
Copy link
Contributor

I just passed by. Didn't have this issue yet.

@bvaughn
Copy link
Owner Author

bvaughn commented Oct 1, 2018

Fixed via 35f99db

@bvaughn bvaughn closed this as completed Oct 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
😭 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants