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

Warn if static flag is accidentally cleared #20807

Merged
merged 3 commits into from Feb 11, 2021

Conversation

@acdlite
Copy link
Member

@acdlite acdlite commented Feb 11, 2021

"Static" fiber flags are flags that are meant to exist for the lifetime of a component. It's really important not to accidentally reset these, because we use them to decide whether or not to perform some operation on a tree (which we can do because they get bubbled via subtreeFlags).

We've had several bugs that were caused by this mistake, so we actually don't rely on static flags anywhere, yet. But we'd like to.

So let's roll out this warning and see if it fires anywhere. Once we can confirm that there are no warnings, we can assume that it's safe to start using static flags.

I did not wrap it behind a feature flag, because it's dev-only, and we can use our internal warning filter to hide this from the console.

"Static" fiber flags are flags that are meant to exist for the lifetime
of a component. It's really important not to accidentally reset these,
because we use them to decide whether or not to perform some operation
on a tree (which we can do because they get bubbled via `subtreeFlags)`.

We've had several bugs that were caused by this mistake, so we actually
don't rely on static flags anywhere, yet. But we'd like to.

So let's roll out this warning and see if it fires anywhere. Once we
can confirm that there are no warnings, we can assume that it's safe
to start using static flags.

I did not wrap it behind a feature flag, because it's dev-only, and we
can use our internal warning filter to hide this from the console.
acdlite added 2 commits Feb 11, 2021
@gaearon
Copy link
Member

@gaearon gaearon commented Feb 11, 2021

Once we can confirm that there are no warnings, we can assume that it's safe to start using static flags.

This seems a bit optimistic because it assumes the problem is on the paths stressed in development. We could make this a hard error as the next step to verify it never fires in production to gain confidence.

@sizebot
Copy link

@sizebot sizebot commented Feb 11, 2021

Comparing: 483358c...99dc7a9

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.min.js = 122.34 kB 122.34 kB = 39.40 kB 39.40 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 128.92 kB 128.92 kB = 41.46 kB 41.46 kB
facebook-www/ReactDOM-prod.classic.js = 404.69 kB 404.69 kB = 75.17 kB 75.17 kB
facebook-www/ReactDOM-prod.modern.js = 393.04 kB 393.04 kB = 73.27 kB 73.27 kB
facebook-www/ReactDOMForked-prod.classic.js = 404.70 kB 404.70 kB = 75.17 kB 75.17 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by 🚫 dangerJS against 99dc7a9

@acdlite
Copy link
Member Author

@acdlite acdlite commented Feb 11, 2021

Is confidence worth the cost of crashing people's apps for a bug that theoretically might happen sometimes?

We actually managed to ship this bug to 1% of users without causing a terrible crash.

@acdlite
Copy link
Member Author

@acdlite acdlite commented Feb 11, 2021

What I would do instead is add production logging to the profiling build

@acdlite acdlite merged commit 696e736 into facebook:master Feb 11, 2021
12 of 23 checks passed
12 of 23 checks passed
ci/circleci: RELEASE_CHANNEL_stable_yarn_build CircleCI is running your tests
Details
ci/circleci: yarn_build CircleCI is running your tests
Details
ci/circleci: yarn_build_combined CircleCI is running your tests
Details
ci/circleci: yarn_lint CircleCI is running your tests
Details
ci/circleci: yarn_test--r=experimental --env=development CircleCI is running your tests
Details
ci/circleci: yarn_test--r=stable --env=development --persistent CircleCI is running your tests
Details
ci/circleci: yarn_test--r=stable --env=production CircleCI is running your tests
Details
ci/circleci: yarn_test--r=www-classic --env=development --variant CircleCI is running your tests
Details
ci/circleci: yarn_test--r=www-modern --env=development CircleCI is running your tests
Details
ci/circleci: yarn_test--r=www-modern --env=development --variant CircleCI is running your tests
Details
ci/codesandbox Building packages...
Details
Facebook CLA Check Contributor License Agreement is valid!
Details
ci/circleci: get_base_build Your tests passed on CircleCI!
Details
ci/circleci: setup Your tests passed on CircleCI!
Details
ci/circleci: sync_reconciler_forks Your tests passed on CircleCI!
Details
ci/circleci: yarn_flow Your tests passed on CircleCI!
Details
ci/circleci: yarn_test--r=experimental --env=production Your tests passed on CircleCI!
Details
ci/circleci: yarn_test--r=stable --env=development Your tests passed on CircleCI!
Details
ci/circleci: yarn_test--r=www-classic --env=development Your tests passed on CircleCI!
Details
ci/circleci: yarn_test--r=www-classic --env=production Your tests passed on CircleCI!
Details
ci/circleci: yarn_test--r=www-classic --env=production --variant Your tests passed on CircleCI!
Details
ci/circleci: yarn_test--r=www-modern --env=production Your tests passed on CircleCI!
Details
ci/circleci: yarn_test--r=www-modern --env=production --variant Your tests passed on CircleCI!
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants