Skip to content

fix className leak #3279

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

Merged
merged 6 commits into from
Nov 19, 2021
Merged

fix className leak #3279

merged 6 commits into from
Nov 19, 2021

Conversation

JoviDeCroock
Copy link
Member

@JoviDeCroock JoviDeCroock commented Oct 8, 2021

Fixes #3159
Fixes #2582

I honestly think it's highly indeterministic to alter the props passed into a component, generally in React (compat) people will pas in either class or className and won't expect this to be changed. Introducing an additional prop is only going to confuse people. Note that we did not do this before

@coveralls
Copy link

coveralls commented Oct 8, 2021

Coverage Status

Coverage remained the same at 99.624% when pulling 9be3898 on fix-class-leak into d744e24 on master.

@github-actions
Copy link

github-actions bot commented Oct 8, 2021

Size Change: 0 B

Total Size: 42 kB

Filename Size Change
compat/dist/compat.module.js 3.42 kB -1 B
compat/dist/compat.umd.js 3.49 kB +1 B
ℹ️ View Unchanged
Filename Size Change
compat/dist/compat.js 3.44 kB 0 B
debug/dist/debug.js 2.99 kB 0 B
debug/dist/debug.module.js 2.98 kB 0 B
debug/dist/debug.umd.js 3.07 kB 0 B
devtools/dist/devtools.js 232 B 0 B
devtools/dist/devtools.module.js 241 B 0 B
devtools/dist/devtools.umd.js 308 B 0 B
dist/preact.js 3.96 kB 0 B
dist/preact.min.js 3.98 kB 0 B
dist/preact.module.js 3.98 kB 0 B
dist/preact.umd.js 4.03 kB 0 B
hooks/dist/hooks.js 1.13 kB 0 B
hooks/dist/hooks.module.js 1.14 kB 0 B
hooks/dist/hooks.umd.js 1.2 kB 0 B
jsx-runtime/dist/jsxRuntime.js 317 B 0 B
jsx-runtime/dist/jsxRuntime.module.js 327 B 0 B
jsx-runtime/dist/jsxRuntime.umd.js 395 B 0 B
test-utils/dist/testUtils.js 437 B 0 B
test-utils/dist/testUtils.module.js 439 B 0 B
test-utils/dist/testUtils.umd.js 515 B 0 B

compressed-size-action

@JoviDeCroock JoviDeCroock deleted the fix-class-leak branch October 10, 2021 17:27
@JoviDeCroock JoviDeCroock restored the fix-class-leak branch November 15, 2021 13:19
@JoviDeCroock JoviDeCroock reopened this Nov 15, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Copy link
Member

@marvinhagemeister marvinhagemeister left a comment

Choose a reason for hiding this comment

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

Awesome 🙌

@nullpaper
Copy link

As a heads up this breaks Router5 <Link> component styles and presumably any React components that are expecting a className prop but getting a preact class. In short:

// Preact `10.5.15`
<Link class='green' />
// -> <a class='green' /> 
// -> WORKS! 🎉

// Preact `10.6.0` (ths PR)
<Link class='green' />
// -> <a />
// -> No class propagation 💥

This is a breaking change for a whole class of components.

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.

Preact compat: class is forwarded without className Preact compat leaks class properties in components
4 participants