Skip to content

Preserving declaration order - #31

Merged
geelen merged 4 commits into
masterfrom
preserve-declaration-order
Sep 28, 2016
Merged

geelen merged 4 commits into
masterfrom
preserve-declaration-order

Conversation

@geelen

@geelen geelen commented Sep 28, 2016

Copy link
Copy Markdown
Member

Inserting a null rule on ComponentStyle creation, then reusing that on each insert. It means that

const X = styled.div` .. `
const Y = styled.div` ... `
const Z = styled.div` ... `

will be guaranteed to be injected in X, Y and Z order, regardless of which order they're rendered in. This is a much more predictable behaviour, but I'm a bit worried about the performance of replacing styles at arbitrary points in the injected styles (since it could potentially invalidate a lot of the existing CSSOM).

Still, I can't think of a better way around it for now. Better to be correct and slow than fast & wrong, at least until we have hard data about performance to base an informed decision.

…n each insert. of all the performance red flags we have introduced so far on this project, this is the most red and the most flag shaped
@geelen geelen changed the title Preserving declaration order (closes #1) Preserving declaration order Sep 28, 2016
@geelen

geelen commented Sep 28, 2016

Copy link
Copy Markdown
Member Author

See #1 for the steps leading here.

@mxstbr

mxstbr commented Sep 28, 2016

Copy link
Copy Markdown
Member

Yeah let's do it like this for now, let's worry about performance later.

@geelen
geelen merged commit 851171c into master Sep 28, 2016
@geelen
geelen deleted the preserve-declaration-order branch September 28, 2016 22:39
@threepointone

Copy link
Copy Markdown

why does preserving declaration order matter? especially when they're hashed based on contents?

besides, because you're deduping, this won't guarantee preserving the order of similar rules declared across modules, yes?

@threepointone

Copy link
Copy Markdown

reading up on #1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants