Skip to content

Should we reorder the head content? #303

@pedrobslisboa

Description

@pedrobslisboa

React reordered the tags that are already inside the head.
I tried to replicate the React behavior for this PR(#300), but it was affecting the hydrate as we weren't keeping the same order on html and model.
I don't know how React manages to avoid the hydrate issue, but take a look at the result from React:

const App = () => {
	return (
		<html lang="en">
			<head>
				<style />
				<link precedence="low" rel="stylesheet" href="/foo.css" />
				<meta charSet="utf-8" /><meta name="viewport" />
			</head>
			<body>
			</body>
		</html>
	)
};

/** HTML
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" />
    <link rel="stylesheet" href="/foo.css" data-precedence="low" />
    <style></style>
  </head>
  <body></body>
</html>
*/

/** Model
0:["$","html",null,{"lang":"en","children":[["$","head",null,{"children":[["$","style",null,{},"$1",
[["App","/Users/pedrolisboa/work/server-reason-react/arch/server/render-rsc-to-stream.js",48,5]],1],["$","link",null,
{"precedence":"low","rel":"stylesheet","href":"/foo.css"},"$1",[["App","/Users/pedrolisboa/work/server-reason-
react/arch/server/render-rsc-to-stream.js",49,5]],1],["$","meta",null,{"charSet":"utf-8"},"$1",
[["App","/Users/pedrolisboa/work/server-reason-react/arch/server/render-rsc-to-stream.js",50,5]],1],["$","meta",null,
{"name":"viewport"},"$1",[["App","/Users/pedrolisboa/work/server-reason-react/arch/server/render-rsc-to-
stream.js",50,29]],1]]},"$1",[["App","/Users/pedrolisboa/work/server-reason-react/arch/server/render-rsc-to-
stream.js",47,4]],1],["$","body",null,{},"$1",[["App","/Users/pedrolisboa/work/server-reason-react/arch/server/render-rsc-
to-stream.js",52,4]],1]]},"$1",[],1]
*/

Should we mimic react? How? Is it possible without a hydration issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions