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

[Float] support meta tags as Resources #25514

Merged
merged 5 commits into from Oct 21, 2022
Merged

[Float] support meta tags as Resources #25514

merged 5 commits into from Oct 21, 2022

Conversation

gnoff
Copy link
Collaborator

@gnoff gnoff commented Oct 19, 2022

Stacked on #25508

This PR adds meta tags as a resource type.

metas are classified in the following priority

  1. charset
  2. http-equiv
  3. property
  4. name
  5. itemprop

when using property, there is special logic for og type properties where a property="og:image:height" following a property="og:image" will inherit the key of the previous tag. this relies on timing effects to stay consistent so when mounting new metas it is important that if structured properties are being used all members of a structure mount together. This is similarly true for arrays where the implicit sequential order defines the array structure. if you need an array you need to mount all array members in the same pass.

@sizebot
Copy link

sizebot commented Oct 19, 2022

Comparing: 1f7a2f5...701f08a

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 = 136.01 kB 136.01 kB = 43.54 kB 43.54 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js +0.82% 152.49 kB 153.75 kB +0.79% 48.64 kB 49.02 kB
facebook-www/ReactDOM-prod.classic.js = 493.94 kB 493.94 kB = 87.90 kB 87.90 kB
facebook-www/ReactDOM-prod.modern.js = 479.20 kB 479.20 kB = 85.72 kB 85.72 kB
facebook-www/ReactDOMForked-prod.classic.js = 493.94 kB 493.94 kB = 87.90 kB 87.90 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.browser.production.min.js +2.11% 48.24 kB 49.26 kB +1.69% 15.01 kB 15.27 kB
oss-experimental/react-dom/umd/react-dom-server-legacy.browser.production.min.js +2.10% 48.35 kB 49.36 kB +1.57% 15.28 kB 15.52 kB
oss-experimental/react-dom/umd/react-dom-server.browser.production.min.js +2.05% 49.22 kB 50.22 kB +1.74% 16.06 kB 16.34 kB
oss-experimental/react-dom/cjs/react-dom-static.browser.production.min.js +2.04% 49.03 kB 50.03 kB +1.56% 15.80 kB 16.05 kB
oss-experimental/react-dom/cjs/react-dom-server.browser.production.min.js +2.04% 49.15 kB 50.15 kB +1.57% 15.85 kB 16.09 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-experimental/react-dom/cjs/react-dom-server-legacy.browser.production.min.js +2.11% 48.24 kB 49.26 kB +1.69% 15.01 kB 15.27 kB
oss-experimental/react-dom/umd/react-dom-server-legacy.browser.production.min.js +2.10% 48.35 kB 49.36 kB +1.57% 15.28 kB 15.52 kB
oss-experimental/react-dom/umd/react-dom-server.browser.production.min.js +2.05% 49.22 kB 50.22 kB +1.74% 16.06 kB 16.34 kB
oss-experimental/react-dom/cjs/react-dom-static.browser.production.min.js +2.04% 49.03 kB 50.03 kB +1.56% 15.80 kB 16.05 kB
oss-experimental/react-dom/cjs/react-dom-server.browser.production.min.js +2.04% 49.15 kB 50.15 kB +1.57% 15.85 kB 16.09 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.node.production.min.js +1.93% 52.54 kB 53.56 kB +1.48% 16.28 kB 16.52 kB
oss-experimental/react-dom/cjs/react-dom-server.node.production.min.js +1.89% 53.05 kB 54.05 kB +1.46% 16.95 kB 17.20 kB
oss-experimental/react-dom/cjs/react-dom-static.node.production.min.js +1.89% 53.05 kB 54.06 kB +1.45% 16.96 kB 17.20 kB
oss-experimental/react-dom/umd/react-dom-server.browser.development.js +0.89% 322.70 kB 325.58 kB +0.58% 71.97 kB 72.39 kB
oss-experimental/react-dom/umd/react-dom-server-legacy.browser.development.js +0.89% 323.69 kB 326.56 kB +0.55% 71.86 kB 72.26 kB
oss-experimental/react-dom/cjs/react-dom-static.browser.development.js +0.89% 306.96 kB 309.68 kB +0.56% 70.98 kB 71.37 kB
oss-experimental/react-dom/cjs/react-dom-server.browser.development.js +0.89% 307.65 kB 310.38 kB +0.55% 71.17 kB 71.56 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.browser.development.js +0.88% 308.62 kB 311.35 kB +0.56% 71.04 kB 71.44 kB
oss-experimental/react-dom/cjs/react-dom-static.node.development.js +0.88% 308.88 kB 311.60 kB +0.55% 71.23 kB 71.62 kB
oss-experimental/react-dom/cjs/react-dom-server.node.development.js +0.88% 308.92 kB 311.64 kB +0.55% 71.14 kB 71.52 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.node.development.js +0.88% 310.33 kB 313.05 kB +0.56% 71.50 kB 71.90 kB
oss-experimental/react-dom/umd/react-dom.production.min.js +0.83% 152.49 kB 153.76 kB +0.92% 49.31 kB 49.76 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js +0.82% 152.49 kB 153.75 kB +0.79% 48.64 kB 49.02 kB
oss-experimental/react-dom/umd/react-dom.profiling.min.js +0.78% 161.32 kB 162.57 kB +0.90% 51.59 kB 52.05 kB
oss-experimental/react-dom/cjs/react-dom.profiling.min.js +0.77% 161.99 kB 163.24 kB +0.73% 51.11 kB 51.48 kB
oss-experimental/react-dom/cjs/react-dom.development.js +0.38% 1,178.36 kB 1,182.85 kB +0.37% 261.16 kB 262.13 kB
oss-experimental/react-dom/umd/react-dom.development.js +0.38% 1,236.01 kB 1,240.68 kB +0.36% 263.99 kB 264.95 kB
oss-stable-semver/react-dom/umd/react-dom-server-legacy.browser.development.js +0.37% 294.72 kB 295.80 kB +0.20% 66.20 kB 66.33 kB
oss-stable/react-dom/umd/react-dom-server-legacy.browser.development.js +0.37% 294.75 kB 295.83 kB +0.20% 66.22 kB 66.36 kB
oss-stable-semver/react-dom/umd/react-dom-server.browser.development.js +0.37% 295.19 kB 296.27 kB +0.20% 66.83 kB 66.97 kB
oss-stable/react-dom/umd/react-dom-server.browser.development.js +0.37% 295.21 kB 296.29 kB +0.20% 66.86 kB 66.99 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.browser.development.js +0.36% 281.11 kB 282.12 kB +0.20% 65.50 kB 65.64 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.browser.development.js +0.36% 281.14 kB 282.14 kB +0.20% 65.53 kB 65.66 kB
oss-stable-semver/react-dom/cjs/react-dom-server.browser.development.js +0.36% 281.58 kB 282.58 kB +0.20% 66.14 kB 66.27 kB
oss-stable/react-dom/cjs/react-dom-server.browser.development.js +0.36% 281.60 kB 282.61 kB +0.19% 66.16 kB 66.29 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.node.development.js +0.36% 282.82 kB 283.83 kB +0.20% 65.97 kB 66.10 kB
oss-stable-semver/react-dom/cjs/react-dom-server.node.development.js +0.36% 282.84 kB 283.85 kB +0.19% 66.10 kB 66.22 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.node.development.js +0.36% 282.84 kB 283.85 kB +0.20% 65.99 kB 66.12 kB
oss-stable/react-dom/cjs/react-dom-server.node.development.js +0.36% 282.86 kB 283.87 kB +0.19% 66.12 kB 66.25 kB
facebook-www/ReactDOMServerStreaming-dev.modern.js +0.32% 289.62 kB 290.55 kB +0.21% 66.37 kB 66.51 kB
facebook-www/ReactDOMServer-dev.modern.js +0.32% 294.12 kB 295.05 kB +0.20% 67.37 kB 67.51 kB
facebook-www/ReactDOMServer-dev.classic.js +0.31% 300.81 kB 301.74 kB +0.21% 68.83 kB 68.97 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.browser.production.min.js +0.25% 38.54 kB 38.64 kB +0.33% 12.67 kB 12.71 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.browser.production.min.js +0.25% 38.56 kB 38.66 kB +0.32% 12.69 kB 12.73 kB
oss-stable-semver/react-dom/umd/react-dom-server-legacy.browser.production.min.js +0.25% 38.65 kB 38.75 kB +0.16% 12.86 kB 12.88 kB
oss-stable/react-dom/umd/react-dom-server-legacy.browser.production.min.js +0.25% 38.67 kB 38.77 kB +0.16% 12.88 kB 12.90 kB
oss-stable-semver/react-dom/umd/react-dom-server.browser.production.min.js +0.23% 41.66 kB 41.76 kB +0.29% 13.95 kB 14.00 kB
oss-stable/react-dom/umd/react-dom-server.browser.production.min.js +0.23% 41.69 kB 41.78 kB +0.29% 13.98 kB 14.02 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.node.production.min.js +0.23% 42.41 kB 42.50 kB +0.27% 13.86 kB 13.89 kB
oss-stable-semver/react-dom/cjs/react-dom-server.browser.production.min.js +0.23% 41.56 kB 41.66 kB +0.29% 13.82 kB 13.86 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.node.production.min.js +0.23% 42.43 kB 42.53 kB +0.27% 13.88 kB 13.92 kB
oss-stable/react-dom/cjs/react-dom-server.browser.production.min.js +0.23% 41.59 kB 41.68 kB +0.29% 13.84 kB 13.88 kB
oss-stable-semver/react-dom/cjs/react-dom-server.node.production.min.js +0.22% 45.06 kB 45.15 kB +0.27% 14.88 kB 14.92 kB
oss-stable/react-dom/cjs/react-dom-server.node.production.min.js +0.22% 45.08 kB 45.18 kB +0.26% 14.90 kB 14.94 kB

Generated by 🚫 dangerJS against 701f08a

@gnoff gnoff changed the title Float metas [Float] support meta tags as Resources Oct 19, 2022
const e = await render(<meta httpequiv="refresh" />, 1);
expect(e.hasAttribute('http-equiv')).toBe(false);
expect(e.getAttribute('httpequiv')).toBe('refresh');
const e = await render(<form acceptcharset="utf-8" />, 1);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Interesting change. Why?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The meta doesn’t match any valid resource type (no key) so it gets omitted. This may be wrong but it’s helpful on the client if we can assume metas are resources.

That said I could have just added a keyable property… I just replaced it with a functionally equivalent test

@@ -2066,7 +2066,9 @@ function commitDeletionEffectsOnFiber(
nearestMountedAncestor,
deletedFiber,
);
releaseResource(deletedFiber.memoizedState);
if (deletedFiber.memoizedState) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

When would it not be set here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If the fiber is a HostResource but the props preclude getting a resource the memoized state will be null. Imagine you update a style sheet to not have a precedence or something. The old resource is released and no new resource is acquired

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I could also have it retain the old state if no new resource was found but that felt wrong to me

<meta property="og:image:foo" content="foo" />
<meta property="og:image:height" content="100" />
<meta property="og:image:width" content="100" />
<meta property="og:image:width:bar" content="bar" />
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hm... We flip the order? That's unfortunate.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

More an artifact of the fact that I did not maintain slots so there was some churn. We could add a little more overhead and track the last meta to insert after rather than insert after the parent instance. How big a deal is this? I assume none given its a client update and so none of this really matter

Copy link
Collaborator

Choose a reason for hiding this comment

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

Right. It probably doesn't matter.

const {props, root, type} = resource;
switch (type) {
case 'title': {
const titles = root.querySelectorAll('title');
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can use getElementsByTagName in this case.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Probably leftover for when I was removing the title nodes and needed a static list. I’ll change

props,
root,
);
insertResourceInstanceBefore(root, instance, titles.item(0));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why .item(0) instead of [0] like you do above?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Item returns null when index overflowing and array notation returns undefined. The insertBefore api technically requires a Node or null though I suspect it would also work with undefined. But I figured it was better to be technically correct

scope = parentInstance.parentElement;
}
}
const metas = scope.querySelectorAll('meta');
Copy link
Collaborator

Choose a reason for hiding this comment

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

One possible idea is to generate a query similar to what you do for acquireStyleResource but generate it in getResource and you use that as the key.

So the key you use for the map is the selector. That way it's reusable for many resources. You could do parentKey + ',' + childKey to find both.

I'm a little concerned about this being n * n traversals for number of meta tags which can be quite a lot since this runs for every meta tag. Not sure a more specific query selector helps though.

Copy link
Collaborator

@sebmarkbage sebmarkbage left a comment

Choose a reason for hiding this comment

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

Let's figure out if we can optimize the acquisition a bit.

@gnoff gnoff marked this pull request as ready for review October 21, 2022 06:14
Copy link
Collaborator

@sebmarkbage sebmarkbage left a comment

Choose a reason for hiding this comment

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

lgtm

@gnoff gnoff merged commit 973b90b into facebook:main Oct 21, 2022
@gnoff gnoff deleted the float-metas branch October 21, 2022 22:21
gnoff added a commit that referenced this pull request Oct 22, 2022
stacked on #25514

This PR adds support for any type of Link as long as it has a string rel
and href and does not include an onLoad or onError property.

The semantics for generic link resources matches other head resources,
they will be inserted and removed as their ref counts go positive and
back to zero.

Keys are based on rel, href, sizes, and media.

on the server preconnect and prefetch-dns are privileged and will emit
near the start of the stream.
facebook-github-bot pushed a commit to facebook/react-native that referenced this pull request Nov 1, 2022
Summary:
This sync includes the following changes:
- **[ab075a232](facebook/react@ab075a232 )**: Do not unmount layout effects on initial Offscreen mount ([#25592](facebook/react#25592)) //<Samuel Susla>//
- **[765805bf8](facebook/react@765805bf8 )**: Fix type check for null ([#25595](facebook/react#25595)) //<Sebastian Markbåge>//
- **[2ac77aab9](facebook/react@2ac77aab9 )**: Clean up vestige of useOpaqueIdentifier ([#25587](facebook/react#25587)) //<Andrew Clark>//
- **[bdd3d0807](facebook/react@bdd3d0807 )**: Extract logic for detecting bad fallback to helper //<Andrew Clark>//
- **[952dfff3f](facebook/react@952dfff3f )**: Split suspended work loop logic into separate functions //<Andrew Clark>//
- **[d2c0ab10d](facebook/react@d2c0ab10d )**: In work loop, add enum of reasons for suspending //<Andrew Clark>//
- **[5450dd409](facebook/react@5450dd409 )**: Strict Mode: Reuse memoized result from first pass ([#25583](facebook/react#25583)) //<Andrew Clark>//
- **[d2a0176a1](facebook/react@d2a0176a1 )**: Detect and warn if use(promise) is wrapped with try/catch block ([#25543](facebook/react#25543)) //<Andrew Clark>//
- **[cf3932be5](facebook/react@cf3932be5 )**: Remove old react-fetch, react-fs and react-pg libraries ([#25577](facebook/react#25577)) //<Sebastian Markbåge>//
- **[28a574ea8](facebook/react@28a574ea8 )**: Try assigning fetch to globalThis if global assignment fails ([#25571](facebook/react#25571)) //<Sebastian Markbåge>//
- **[09def5990](facebook/react@09def5990 )**: [Float] handle noscript context for Resources ([#25559](facebook/react#25559)) //<Josh Story>//
- **[17204056d](facebook/react@17204056d )**: [Float] fix coordination of resource identity and hydration ([#25569](facebook/react#25569)) //<Josh Story>//
- **[d925a8d0b](facebook/react@d925a8d0b )**: Flight client error stack ([#25560](facebook/react#25560)) //<Josh Story>//
- **[996b00b78](facebook/react@996b00b78 )**: [Tiny] Fixed incorrect import in `react-server-dom-webpack` ([#25554](facebook/react#25554)) //<Leo Lamprecht>//
- **[e7c5af45c](facebook/react@e7c5af45c )**: Update cache() and use() to the canary aka next channel ([#25502](facebook/react#25502)) //<Sebastian Markbåge>//
- **[fa77f52e7](facebook/react@fa77f52e7 )**: Unify promise switch statements //<Andrew Clark>//
- **[7572e4931](facebook/react@7572e4931 )**: Track thenable state in work loop //<Andrew Clark>//
- **[7fc3eefd8](facebook/react@7fc3eefd8 )**: Revert yieldy behavior for non-use Suspense (in Flight, too) //<Andrew Clark>//
- **[61f9b5e97](facebook/react@61f9b5e97 )**: [Float] support <base> as Resource ([#25546](facebook/react#25546)) //<Josh Story>//
- **[1d3fc9c9c](facebook/react@1d3fc9c9c )**: Bug fix when resolving cache ([#25545](facebook/react#25545)) //<Sebastian Markbåge>//
- **[cce18e350](facebook/react@cce18e350 )**: [Flight] Use AsyncLocalStorage to extend the scope of the cache to micro tasks ([#25542](facebook/react#25542)) //<Sebastian Markbåge>//
- **[caa84c8da](facebook/react@caa84c8da )**: Revert fetch instrumentation to only RSC ([#25540](facebook/react#25540)) //<Sebastian Markbåge>//
- **[0c11baa6a](facebook/react@0c11baa6a )**: add warnings for non-resources rendered outside body or head ([#25532](facebook/react#25532)) //<Josh Story>//
- **[9236abdb5](facebook/react@9236abdb5 )**: when float is enabled only push title and script as a single unit ([#25536](facebook/react#25536)) //<Josh Story>//
- **[dd5c20825](facebook/react@dd5c20825 )**: Revert yieldy behavior for non-use Suspense ([#25537](facebook/react#25537)) //<Andrew Clark>//
- **[934177598](facebook/react@934177598 )**: fix transposed escape functions ([#25534](facebook/react#25534)) //<Josh Story>//
- **[d1ced9fd5](facebook/react@d1ced9fd5 )**: [Float] support all links as Resources ([#25515](facebook/react#25515)) //<Josh Story>//
- **[973b90bdf](facebook/react@973b90bdf )**: [Float] support meta tags as Resources ([#25514](facebook/react#25514)) //<Josh Story>//
- **[79c582981](facebook/react@79c582981 )**: Let ReactDOM initialize in RSC ([#25503](facebook/react#25503)) //<Sebastian Markbåge>//
- **[1f7a2f577](facebook/react@1f7a2f577 )**: [Float] support title tags as Resources ([#25508](facebook/react#25508)) //<Josh Story>//
- **[c63580787](facebook/react@c63580787 )**: Support `use` in `act` testing API ([#25523](facebook/react#25523)) //<Andrew Clark>//
- **[65e32e58b](facebook/react@65e32e58b )**: Add fetch Instrumentation to Dedupe Fetches ([#25516](facebook/react#25516)) //<Sebastian Markbåge>//
- **[9336e29d9](facebook/react@9336e29d9 )**: [useEvent] Lint for presence of useEvent functions in dependency lists ([#25512](facebook/react#25512)) //<lauren>//
- **[3cc792bfb](facebook/react@3cc792bfb )**: [useEvent] Non-stable function identity ([#25473](facebook/react#25473)) //<lauren>//
- **[987292815](facebook/react@987292815 )**: Remove feature flag enableStrictEffects ([#25387](facebook/react#25387)) //<Samuel Susla>//
- **[8e2bde6f2](facebook/react@8e2bde6f2 )**: Add cache() API ([#25506](facebook/react#25506)) //<Sebastian Markbåge>//
- **[9cdf8a99e](facebook/react@9cdf8a99e )**: [Codemod] Update copyright header to Meta ([#25315](facebook/react#25315)) //<Andrew Clark>//
- **[e54015e26](facebook/react@e54015e26 )**: Refactor: fill in the flow missing type ([#25496](facebook/react#25496)) //<c0dedance>//
- **[3b1fd5767](facebook/react@3b1fd5767 )**: refactor: Flow: typing of Scheduler ([#25485](facebook/react#25485)) //<bubucuo>//
- **[14072ce64](facebook/react@14072ce64 )**: Add detach to Offscreen component ([#25265](facebook/react#25265)) //<Samuel Susla>//
- **[3bb71dfd4](facebook/react@3bb71dfd4 )**: Rename react-server-dom-webpack entry points to /client and /server ([#25504](facebook/react#25504)) //<Sebastian Markbåge>//
- **[71f2c8cf1](facebook/react@71f2c8cf1 )**: move resource acquisition to mutation phase ([#25500](facebook/react#25500)) //<Josh Story>//
- **[500bea532](facebook/react@500bea532 )**: Add option to load Fizz runtime from external file ([#25499](facebook/react#25499)) //<Andrew Clark>//
- **[4494f2a86](facebook/react@4494f2a86 )**: [Float] add support for scripts and other enhancements ([#25480](facebook/react#25480)) //<Josh Story>//
- **[9ecf84ed7](facebook/react@9ecf84ed7 )**: Bugfix: Suspending in shell during discrete update ([#25495](facebook/react#25495)) //<Andrew Clark>//

Changelog:
[General][Changed] - React Native sync for revisions 54f297a...ab075a2

jest_e2e[run_all_tests]

Reviewed By: kassens

Differential Revision: D40897093

fbshipit-source-id: 6a040315834dea5c0ab994ea94d91f5605b9d6b0
rickhanlonii pushed a commit that referenced this pull request Dec 3, 2022
Stacked on #25508

This PR adds meta tags as a resource type.

metas are classified in the following priority

1. charset
2. http-equiv
3. property
4. name
5. itemprop

when using property, there is special logic for og type properties where
a `property="og:image:height"` following a `property="og:image"` will
inherit the key of the previous tag. this relies on timing effects to
stay consistent so when mounting new metas it is important that if
structured properties are being used all members of a structure mount
together. This is similarly true for arrays where the implicit
sequential order defines the array structure. if you need an array you
need to mount all array members in the same pass.
rickhanlonii pushed a commit that referenced this pull request Dec 3, 2022
stacked on #25514

This PR adds support for any type of Link as long as it has a string rel
and href and does not include an onLoad or onError property.

The semantics for generic link resources matches other head resources,
they will be inserted and removed as their ref counts go positive and
back to zero.

Keys are based on rel, href, sizes, and media.

on the server preconnect and prefetch-dns are privileged and will emit
near the start of the stream.
mofeiZ pushed a commit to mofeiZ/react that referenced this pull request Dec 5, 2022
Stacked on facebook#25508

This PR adds meta tags as a resource type.

metas are classified in the following priority

1. charset
2. http-equiv
3. property
4. name
5. itemprop

when using property, there is special logic for og type properties where
a `property="og:image:height"` following a `property="og:image"` will
inherit the key of the previous tag. this relies on timing effects to
stay consistent so when mounting new metas it is important that if
structured properties are being used all members of a structure mount
together. This is similarly true for arrays where the implicit
sequential order defines the array structure. if you need an array you
need to mount all array members in the same pass.
mofeiZ pushed a commit to mofeiZ/react that referenced this pull request Dec 5, 2022
stacked on facebook#25514

This PR adds support for any type of Link as long as it has a string rel
and href and does not include an onLoad or onError property.

The semantics for generic link resources matches other head resources,
they will be inserted and removed as their ref counts go positive and
back to zero.

Keys are based on rel, href, sizes, and media.

on the server preconnect and prefetch-dns are privileged and will emit
near the start of the stream.
OlimpiaZurek pushed a commit to OlimpiaZurek/react-native that referenced this pull request May 22, 2023
Summary:
This sync includes the following changes:
- **[ab075a232](facebook/react@ab075a232 )**: Do not unmount layout effects on initial Offscreen mount ([facebook#25592](facebook/react#25592)) //<Samuel Susla>//
- **[765805bf8](facebook/react@765805bf8 )**: Fix type check for null ([facebook#25595](facebook/react#25595)) //<Sebastian Markbåge>//
- **[2ac77aab9](facebook/react@2ac77aab9 )**: Clean up vestige of useOpaqueIdentifier ([facebook#25587](facebook/react#25587)) //<Andrew Clark>//
- **[bdd3d0807](facebook/react@bdd3d0807 )**: Extract logic for detecting bad fallback to helper //<Andrew Clark>//
- **[952dfff3f](facebook/react@952dfff3f )**: Split suspended work loop logic into separate functions //<Andrew Clark>//
- **[d2c0ab10d](facebook/react@d2c0ab10d )**: In work loop, add enum of reasons for suspending //<Andrew Clark>//
- **[5450dd409](facebook/react@5450dd409 )**: Strict Mode: Reuse memoized result from first pass ([facebook#25583](facebook/react#25583)) //<Andrew Clark>//
- **[d2a0176a1](facebook/react@d2a0176a1 )**: Detect and warn if use(promise) is wrapped with try/catch block ([facebook#25543](facebook/react#25543)) //<Andrew Clark>//
- **[cf3932be5](facebook/react@cf3932be5 )**: Remove old react-fetch, react-fs and react-pg libraries ([facebook#25577](facebook/react#25577)) //<Sebastian Markbåge>//
- **[28a574ea8](facebook/react@28a574ea8 )**: Try assigning fetch to globalThis if global assignment fails ([facebook#25571](facebook/react#25571)) //<Sebastian Markbåge>//
- **[09def5990](facebook/react@09def5990 )**: [Float] handle noscript context for Resources ([facebook#25559](facebook/react#25559)) //<Josh Story>//
- **[17204056d](facebook/react@17204056d )**: [Float] fix coordination of resource identity and hydration ([facebook#25569](facebook/react#25569)) //<Josh Story>//
- **[d925a8d0b](facebook/react@d925a8d0b )**: Flight client error stack ([facebook#25560](facebook/react#25560)) //<Josh Story>//
- **[996b00b78](facebook/react@996b00b78 )**: [Tiny] Fixed incorrect import in `react-server-dom-webpack` ([facebook#25554](facebook/react#25554)) //<Leo Lamprecht>//
- **[e7c5af45c](facebook/react@e7c5af45c )**: Update cache() and use() to the canary aka next channel ([facebook#25502](facebook/react#25502)) //<Sebastian Markbåge>//
- **[fa77f52e7](facebook/react@fa77f52e7 )**: Unify promise switch statements //<Andrew Clark>//
- **[7572e4931](facebook/react@7572e4931 )**: Track thenable state in work loop //<Andrew Clark>//
- **[7fc3eefd8](facebook/react@7fc3eefd8 )**: Revert yieldy behavior for non-use Suspense (in Flight, too) //<Andrew Clark>//
- **[61f9b5e97](facebook/react@61f9b5e97 )**: [Float] support <base> as Resource ([facebook#25546](facebook/react#25546)) //<Josh Story>//
- **[1d3fc9c9c](facebook/react@1d3fc9c9c )**: Bug fix when resolving cache ([facebook#25545](facebook/react#25545)) //<Sebastian Markbåge>//
- **[cce18e350](facebook/react@cce18e350 )**: [Flight] Use AsyncLocalStorage to extend the scope of the cache to micro tasks ([facebook#25542](facebook/react#25542)) //<Sebastian Markbåge>//
- **[caa84c8da](facebook/react@caa84c8da )**: Revert fetch instrumentation to only RSC ([facebook#25540](facebook/react#25540)) //<Sebastian Markbåge>//
- **[0c11baa6a](facebook/react@0c11baa6a )**: add warnings for non-resources rendered outside body or head ([facebook#25532](facebook/react#25532)) //<Josh Story>//
- **[9236abdb5](facebook/react@9236abdb5 )**: when float is enabled only push title and script as a single unit ([facebook#25536](facebook/react#25536)) //<Josh Story>//
- **[dd5c20825](facebook/react@dd5c20825 )**: Revert yieldy behavior for non-use Suspense ([facebook#25537](facebook/react#25537)) //<Andrew Clark>//
- **[934177598](facebook/react@934177598 )**: fix transposed escape functions ([facebook#25534](facebook/react#25534)) //<Josh Story>//
- **[d1ced9fd5](facebook/react@d1ced9fd5 )**: [Float] support all links as Resources ([facebook#25515](facebook/react#25515)) //<Josh Story>//
- **[973b90bdf](facebook/react@973b90bdf )**: [Float] support meta tags as Resources ([facebook#25514](facebook/react#25514)) //<Josh Story>//
- **[79c582981](facebook/react@79c582981 )**: Let ReactDOM initialize in RSC ([facebook#25503](facebook/react#25503)) //<Sebastian Markbåge>//
- **[1f7a2f577](facebook/react@1f7a2f577 )**: [Float] support title tags as Resources ([facebook#25508](facebook/react#25508)) //<Josh Story>//
- **[c63580787](facebook/react@c63580787 )**: Support `use` in `act` testing API ([facebook#25523](facebook/react#25523)) //<Andrew Clark>//
- **[65e32e58b](facebook/react@65e32e58b )**: Add fetch Instrumentation to Dedupe Fetches ([facebook#25516](facebook/react#25516)) //<Sebastian Markbåge>//
- **[9336e29d9](facebook/react@9336e29d9 )**: [useEvent] Lint for presence of useEvent functions in dependency lists ([facebook#25512](facebook/react#25512)) //<lauren>//
- **[3cc792bfb](facebook/react@3cc792bfb )**: [useEvent] Non-stable function identity ([facebook#25473](facebook/react#25473)) //<lauren>//
- **[987292815](facebook/react@987292815 )**: Remove feature flag enableStrictEffects ([facebook#25387](facebook/react#25387)) //<Samuel Susla>//
- **[8e2bde6f2](facebook/react@8e2bde6f2 )**: Add cache() API ([facebook#25506](facebook/react#25506)) //<Sebastian Markbåge>//
- **[9cdf8a99e](facebook/react@9cdf8a99e )**: [Codemod] Update copyright header to Meta ([facebook#25315](facebook/react#25315)) //<Andrew Clark>//
- **[e54015e26](facebook/react@e54015e26 )**: Refactor: fill in the flow missing type ([facebook#25496](facebook/react#25496)) //<c0dedance>//
- **[3b1fd5767](facebook/react@3b1fd5767 )**: refactor: Flow: typing of Scheduler ([facebook#25485](facebook/react#25485)) //<bubucuo>//
- **[14072ce64](facebook/react@14072ce64 )**: Add detach to Offscreen component ([facebook#25265](facebook/react#25265)) //<Samuel Susla>//
- **[3bb71dfd4](facebook/react@3bb71dfd4 )**: Rename react-server-dom-webpack entry points to /client and /server ([facebook#25504](facebook/react#25504)) //<Sebastian Markbåge>//
- **[71f2c8cf1](facebook/react@71f2c8cf1 )**: move resource acquisition to mutation phase ([facebook#25500](facebook/react#25500)) //<Josh Story>//
- **[500bea532](facebook/react@500bea532 )**: Add option to load Fizz runtime from external file ([facebook#25499](facebook/react#25499)) //<Andrew Clark>//
- **[4494f2a86](facebook/react@4494f2a86 )**: [Float] add support for scripts and other enhancements ([facebook#25480](facebook/react#25480)) //<Josh Story>//
- **[9ecf84ed7](facebook/react@9ecf84ed7 )**: Bugfix: Suspending in shell during discrete update ([facebook#25495](facebook/react#25495)) //<Andrew Clark>//

Changelog:
[General][Changed] - React Native sync for revisions 54f297a...ab075a2

jest_e2e[run_all_tests]

Reviewed By: kassens

Differential Revision: D40897093

fbshipit-source-id: 6a040315834dea5c0ab994ea94d91f5605b9d6b0
jerrydev0927 added a commit to jerrydev0927/react that referenced this pull request Jan 5, 2024
stacked on facebook/react#25514

This PR adds support for any type of Link as long as it has a string rel
and href and does not include an onLoad or onError property.

The semantics for generic link resources matches other head resources,
they will be inserted and removed as their ref counts go positive and
back to zero.

Keys are based on rel, href, sizes, and media.

on the server preconnect and prefetch-dns are privileged and will emit
near the start of the stream.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants