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(react): Remove unstable APIs #44896

Merged
merged 5 commits into from
Jun 24, 2020

Conversation

eps1lon
Copy link
Collaborator

@eps1lon eps1lon commented May 19, 2020

If you came here because this broke type-checking for you: You were probably using unstable, undocumented APIs. If you still want to use them without supressing type checking, you can add them back via module augmentation:

unstable APIs of `react`
import * as React from 'react';

declare module 'react' {
    // unstable observedBits
    interface ConsumerProps<T> {
        unstable_observedBits?: number;
    }
    function createContext<T>(
        defaultValue: unknown,
        unstable_calculateChangedBits?: (prev: T, next: T) => number
    ): Context<T>;

    // unstable Suspense API
    interface SuspenseProps {
        /**	
         * Tells React whether to “skip” revealing this boundary during the initial load.	
         * This API will likely be removed in a future release.	
         */
        // NOTE: this is unflagged and is respected even in stable builds	
        unstable_avoidThisFallback?: boolean;
    }
}

Closes #44886

@typescript-bot
Copy link
Contributor

typescript-bot commented May 19, 2020

@eps1lon Thank you for submitting this PR!

Code Reviews

Because this is a widely-used package, a DT maintainer will need to review it before it can be merged.

Status

  • ✅ No merge conflicts
  • ✅ Continuous integration tests have passed
  • ❌ Most recent commit is approved by DT maintainers

Once every item on this list is checked, I'll ask you for permission to merge and publish the changes.


Diagnostic Information: What the bot saw about this PR
{
  "type": "info",
  "now": "-",
  "pr_number": 44896,
  "author": "eps1lon",
  "owners": [
    "johnnyreilly",
    "bbenezech",
    "pzavolinsky",
    "digiguru",
    "ericanderson",
    "DovydasNavickas",
    "theruther4d",
    "guilhermehubner",
    "ferdaber",
    "jrakotoharisoa",
    "pascaloliv",
    "hotell",
    "franklixuefei",
    "Jessidhia",
    "saranshkataria",
    "lukyth",
    "eps1lon",
    "zieka",
    "dancerphil",
    "dimitropoulos",
    "disjukr",
    "vhfmag",
    "hellatan"
  ],
  "dangerLevel": "ScopedAndTested",
  "headCommitAbbrOid": "03f1ea4",
  "headCommitOid": "03f1ea4bcd7ae34bd78e23fd9394f98aa408e4ae",
  "mergeIsRequested": false,
  "stalenessInDays": 0,
  "lastCommitDate": "2020-06-23T08:10:53.000Z",
  "lastCommentDate": "2020-06-23T21:14:23.000Z",
  "reviewLink": "https://github.com/DefinitelyTyped/DefinitelyTyped/pull/44896/files",
  "hasMergeConflict": false,
  "authorIsOwner": true,
  "isFirstContribution": false,
  "popularityLevel": "Critical",
  "anyPackageIsNew": false,
  "packages": [
    "react"
  ],
  "files": [
    {
      "filePath": "types/react/index.d.ts",
      "kind": "definition",
      "package": "react"
    },
    {
      "filePath": "types/react/test/tsx.tsx",
      "kind": "test",
      "package": "react"
    }
  ],
  "hasDismissedReview": false,
  "ciResult": "pass",
  "reviewersWithStaleReviews": [
    {
      "reviewedAbbrOid": "b2356e6",
      "reviewer": "dimitropoulos",
      "date": "2020-05-20T12:14:55Z"
    },
    {
      "reviewedAbbrOid": "c39d69c",
      "reviewer": "ferdaber",
      "date": "2020-05-19T21:02:48Z"
    },
    {
      "reviewedAbbrOid": "44455d1",
      "reviewer": "johnnyreilly",
      "date": "2020-05-19T20:29:19Z"
    }
  ],
  "approvalFlags": 0,
  "isChangesRequested": false
}

@typescript-bot
Copy link
Contributor

typescript-bot commented May 19, 2020

🔔 @johnnyreilly @bbenezech @pzavolinsky @digiguru @ericanderson @DovydasNavickas @theruther4d @guilhermehubner @ferdaber @jrakotoharisoa @pascaloliv @Hotell @franklixuefei @Jessidhia @saranshkataria @lukyth @zieka @dancerphil @dimitropoulos @disjukr @vhfmag @hellatan - please review this PR in the next few days. Be sure to explicitly select Approve or Request Changes in the GitHub UI so I know what's going on.

@typescript-bot typescript-bot moved this from Other to Waiting for Code Reviews in New Pull Request Status Board May 19, 2020
Copy link
Member

@johnnyreilly johnnyreilly left a comment

Choose a reason for hiding this comment

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

I'm fine with this shipping as it will resolve the issues raised by @gaearon in the linked issue. Would appreciate a second pair of eyes on this too.

@johnnyreilly
Copy link
Member

@eps1lon looks like there's some test failures?

@eps1lon
Copy link
Collaborator Author

eps1lon commented May 19, 2020

@eps1lon looks like there's some test failures?

I can reproduce these on master as well. I can work on a separate PR to fix them. Though we'd loose a bit of confidence since I can't branch $ExpectType depending on the TypeScript version, no?

@typescript-bot typescript-bot added the Owner Approved A listed owner of this package signed off on the pull request. label May 19, 2020
@ferdaber
Copy link
Contributor

Will there be changes to react-dom as well? Which I think has unstable_batchedUpdates.

@eps1lon
Copy link
Collaborator Author

eps1lon commented May 19, 2020

Will there be changes to react-dom as well? Which I think has unstable_batchedUpdates.

I think we should get these in as well.

@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Author Action in New Pull Request Status Board May 19, 2020
@typescript-bot typescript-bot removed Owner Approved A listed owner of this package signed off on the pull request. The Travis CI build failed labels May 19, 2020
@typescript-bot typescript-bot moved this from Needs Author Action to Waiting for Code Reviews in New Pull Request Status Board May 19, 2020
@gaearon
Copy link

gaearon commented May 19, 2020

I would keep unstable_batchedUpdates and unstable_renderSubtreeIntoContainer. They have a special status because de facto they're widely used, and we can't change their semantics.

@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Author Action in New Pull Request Status Board May 19, 2020
@typescript-bot
Copy link
Contributor

@eps1lon The Travis CI build failed! Please review the logs for more information.

Once you've pushed the fixes, the build will automatically re-run. Thanks!

@typescript-bot
Copy link
Contributor

👋 Hi there! I’ve run some quick measurements against master and your PR. These metrics should help the humans reviewing this PR gauge whether it might negatively affect compile times or editor responsiveness for users who install these typings.

Let’s review the numbers, shall we?

Comparison details 📊
master #44896 diff
Batch compilation
Memory usage (MiB) 123.7 126.8 +2.5%
Type count 41436 41463 0%
Assignability cache size 64480 64495 0%
Language service
Samples taken 2236 2252 +1%
Identifiers in tests 2764 2780 +1%
getCompletionsAtPosition
    Mean duration (ms) 359.5 360.4 +0.2%
    Mean CV 7.7% 7.6%
    Worst duration (ms) 2287.9 2332.1 +1.9%
    Worst identifier props memoized4Ref
getQuickInfoAtPosition
    Mean duration (ms) 354.7 355.9 +0.3%
    Mean CV 7.5% 7.4% -1.3%
    Worst duration (ms) 1962.3 2153.5 +9.7%
    Worst identifier ref ref

It looks like nothing changed too much. I won’t post performance data again unless it gets worse.

@eps1lon eps1lon force-pushed the fix/react/remove-unstable branch from b2356e6 to 288ac0a Compare June 2, 2020 06:14
@typescript-bot typescript-bot added The CI failed When GH Actions fails and removed Owner Approved A listed owner of this package signed off on the pull request. Where is GH Actions? GH Actions didn't give a response to this PR labels Jun 3, 2020
@typescript-bot
Copy link
Contributor

@eps1lon The CI build failed! Please review the logs for more information.

Once you've pushed the fixes, the build will automatically re-run. Thanks!

@typescript-bot
Copy link
Contributor

@eps1lon The CI build failed! Please review the logs for more information.

Once you've pushed the fixes, the build will automatically re-run. Thanks!

@eps1lon eps1lon force-pushed the fix/react/remove-unstable branch from 8719c35 to a3c4973 Compare June 9, 2020 19:37
@typescript-bot
Copy link
Contributor

@eps1lon The CI build failed! Please review the logs for more information.

Once you've pushed the fixes, the build will automatically re-run. Thanks!

@typescript-bot typescript-bot removed the The CI failed When GH Actions fails label Jun 10, 2020
@typescript-bot typescript-bot moved this from Needs Author Action to Needs Maintainer Review in New Pull Request Status Board Jun 10, 2020
@typescript-bot
Copy link
Contributor

@dimitropoulos, @ferdaber, @johnnyreilly Thank you for reviewing this PR! The author has pushed new commits since your last review. Could you take another look and submit a fresh review?

@eps1lon
Copy link
Collaborator Author

eps1lon commented Jun 10, 2020

Only rebased onto master to get the PR green.

@eps1lon
Copy link
Collaborator Author

eps1lon commented Jun 23, 2020

@sandersn Could you remove the label? The build is passing and the bot doesn't want to remove the label. Or someone manually merge this manually.

@sandersn
Copy link
Contributor

This is in the correct bucket -- Needs Maintainer Review -- because the new bot ignores the Travis label.
The Needs Maintainer Review bucket is just full right now -- over 100 PRs for the maintainer to review, so I expect it'll take a while to get through all those.

@elibarzilay elibarzilay merged commit e4514c3 into DefinitelyTyped:master Jun 24, 2020
@typescript-bot typescript-bot removed this from Needs Maintainer Review in New Pull Request Status Board Jun 24, 2020
@typescript-bot
Copy link
Contributor

I just published @types/react@16.9.39 to npm.

@paranoidjk
Copy link
Contributor

@epabst

---defaultValue: unknown,
+++defaultValue: T,

@eps1lon eps1lon deleted the fix/react/remove-unstable branch June 24, 2020 07:48
ngbrown pushed a commit to ngbrown-forks/DefinitelyTyped that referenced this pull request Jul 11, 2020
* fix(react): Remove unstable APIs

* Add regression tests

* fix(react-dom): Remove unstable APIs

* Revert "fix(react-dom): Remove unstable APIs"

This reverts commit 3653977.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author is Owner The author of this PR is a listed owner of the package. Critical package Perf: Same typescript-bot determined that this PR will not significantly impact compilation performance.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[@types/react] Remove calculateChangedBits from createContext
9 participants