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

[Flight] Encode Symbols as special rows that can be referenced by models … #20171

Merged
merged 3 commits into from
Nov 11, 2020

Commits on Nov 11, 2020

  1. Encode Symbols as special rows that can be referenced by models

    If a symbol was extracted from Symbol.for(...) then we can reliably
    recreate the same symbol on the client.
    
    S123:"react.suspense"
    M456:{mySymbol: '$123'}
    
    This doesn't suffer from the XSS problem because you have to write actual
    code to create one of these symbols. That problem is only a problem because
    values pass through common other usages of JSON which are not secure.
    
    Since React encodes its built-ins as symbols, we can now use them as long
    as its props are serializable. Like Suspense.
    sebmarkbage committed Nov 11, 2020
    Configuration menu
    Copy the full SHA
    6b22668 View commit details
    Browse the repository at this point in the history
  2. Refactor resolution to avoid memo hack

    Going through createElement isn't quite equivalent for ref and key in props.
    sebmarkbage committed Nov 11, 2020
    Configuration menu
    Copy the full SHA
    0236fd7 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    4e71e3a View commit details
    Browse the repository at this point in the history