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) - Error boundary not applying in array cases #1572

Merged
merged 18 commits into from
Apr 26, 2019

Conversation

JoviDeCroock
Copy link
Member

@JoviDeCroock JoviDeCroock commented Apr 24, 2019

In cases where a series of components would throw the ErrorBoundary would get skipped since _processingException would be filled. This check made for it to be skipped and thus thrown resulting in faulty behavior.

This change seems to break testing in some way... :/ wondering if this could be something to do with cleaning up tests or related?

Tests seem to run really inconsistent, anyone has any clue as to why this could happen...

Like I know it probably loops or something somewhere but I can't tell where since I have no error output, I'm also having difficulties seeing how _processingException is bypassing that.

Fixes: #1570
Removes 23B from core
Adds 8B to core

@JoviDeCroock JoviDeCroock changed the title (fix) - Error boundary not applying in nested cases (fix) - Error boundary not applying in array cases Apr 24, 2019
@coveralls
Copy link

coveralls commented Apr 25, 2019

Coverage Status

Coverage remained the same at 100.0% when pulling cfeb001 on fix/errorBoundary into 3396e3e on master.

@JoviDeCroock
Copy link
Member Author

JoviDeCroock commented Apr 25, 2019

All checks are successfull in travis, but the performance things are still failing locally with yarn test:karma:watch so don't merge!

Issue at hand if anyone knows more:

FAILED TESTS:
  performance
    × should rerender without changes fast
      HeadlessChrome 73.0.3683 (Windows 10.0.0)
    Error: Uncaught AssertionError: Inner after componentWillUnmount: expected <div id="InnerDiv"></div> to not exist (node_modules/chai/chai.js:239)

No clue how to debug this perf build at this moment.

Travis only completes 480/600 tests and then reports a success.

@JoviDeCroock
Copy link
Member Author

Okay, I think all is fixed now! :D

@@ -58,6 +58,7 @@ export interface Component<P = {}, S = {}> extends preact.Component<P, S> {
_prevVNode?: VNode | null;
_ancestorComponent?: Component<any, any>;
_processingException?: Component<any, any> | null;
_pendingError?: Component<any, any> | null;
Copy link
Member

Choose a reason for hiding this comment

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

Nit: We need to add this to our mangling properties to avoid potential name clashes.

Copy link
Member Author

Choose a reason for hiding this comment

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

Does it matter what name I give it? Was wondering that since I see clashing names in mangle and that worries me to pick one.

Copy link
Member Author

Choose a reason for hiding this comment

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

Mangling this to __E actually adds 3B

Copy link
Member

Choose a reason for hiding this comment

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

The default is to mangle _ properties to single-letter variables, so that makes sense. However, we want to avoid single-letter property names since they're likely to collide.

Copy link
Member

@marvinhagemeister marvinhagemeister left a comment

Choose a reason for hiding this comment

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

Awesome work 🎉 I'm amazed by how much smaller the PR got 👍 Have one little nit regarding the mangled property names 👍

Copy link
Member

@developit developit 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'd like to test this on my suspense demo thing but won't have time this week.

@JoviDeCroock JoviDeCroock merged commit 239b809 into master Apr 26, 2019
@JoviDeCroock JoviDeCroock deleted the fix/errorBoundary branch April 26, 2019 05:28
lordvlad added a commit to lordvlad/preact that referenced this pull request Apr 30, 2019
* upstream/master: (341 commits)
  Revert "Simplify originalDom check (-4 B)
"
  Simplify originalDom check (-4 B)
  Add back mistakenly removed JSDoc comment
  Remove unnecessary code from `diffChildren` (-16 B)
  Golf createContext (-6 B)
  Fix useContext test spacing
  Remove `dom` parameter from `diff()` (-11 B)
  Move all component diff'ing logic into component diff condition (-6 B)
  fix issue by marking dirty before .render since this can potentially add another entry on the render queue
  add relevant test
  (chore) - remove focusElement (preactjs#1548)
  Update type definition (preactjs#1581)
  Compress code, assume EMPTY_OBJ._children == null
  Refactor out variables from diffChildren
  Compress diffChildren further
  Compress diffChildren further
  Condense code in diffChildren
  Fix infinite loop because of props mutation (preactjs#1577)
  (fix) - Error boundary not applying in array cases (preactjs#1572)
  Add styled-components example (preactjs#1574)
  ...

# Conflicts:
#	.eslintignore
#	compat/mangle.json
#	compat/src/index.js
#	compat/src/internal.d.ts
#	debug/mangle.json
#	hooks/src/index.d.ts
#	hooks/src/index.js
#	hooks/src/internal.d.ts
#	mangle.json
#	package.json
#	src/component.js
#	src/constants.js
#	src/create-context.js
#	src/create-element.js
#	src/diff/children.js
#	src/diff/index.js
#	src/diff/props.js
#	src/index.d.ts
#	src/internal.d.ts
#	src/jsx.d.ts
#	src/render.js
#	src/util.js
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.

Error boundary doesn't catch subsequent errors
4 participants