Skip to content

revert: Bring back strict-equality bailout for children even w/ context updates #4724

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 1 commit into from
Mar 10, 2025

Conversation

rschristian
Copy link
Member

@rschristian rschristian commented Mar 9, 2025

Reverts a portion of #4048

This has been a bit of an annoyance in preact-iso for a while; essentially, when navigating between async routes, our router will render both children (outgoing & incoming) once before swapping over to just the incoming. Because of #4048, which altered this conditional from (!c._force && c.sCU() == false) || new._orig == old._orig to !c._force && (c.sCU() === false || new orig == old.orig), the outgoing route would now be rerendered with the new context value. Rerenders aren't great but this was specifically problematic as it was rerendering with location data that component should never see in the first place which can result in a few weird surprises for users.

Jovi & I had originally talked a bit about this prior to preactjs/preact-iso#37, but we decided to just comment out the failing tests with a note as we only caught it long after the fact. It seems part of the prior PR can be safely reverted though, keeping the tests the user added.

Copy link

github-actions bot commented Mar 9, 2025

📊 Tachometer Benchmark Results

Summary

duration

  • create10k: unsure 🔍 -1% - +1% (-7.99ms - +4.90ms)
    preact-local vs preact-main
  • filter-list: unsure 🔍 -0% - +1% (-0.02ms - +0.12ms)
    preact-local vs preact-main
  • hydrate1k: unsure 🔍 -1% - +1% (-1.11ms - +0.93ms)
    preact-local vs preact-main
  • many-updates: unsure 🔍 -1% - +1% (-0.09ms - +0.20ms)
    preact-local vs preact-main
  • replace1k: unsure 🔍 -2% - +0% (-1.40ms - +0.23ms)
    preact-local vs preact-main
  • text-update: unsure 🔍 -5% - +4% (-0.11ms - +0.09ms)
    preact-local vs preact-main
  • todo: unsure 🔍 -1% - +0% (-0.29ms - +0.16ms)
    preact-local vs preact-main
  • update10th1k: unsure 🔍 -5% - +1% (-1.63ms - +0.37ms)
    preact-local vs preact-main

usedJSHeapSize

  • create10k: unsure 🔍 +0% - +0% (+0.00ms - +0.00ms)
    preact-local vs preact-main
  • filter-list: unsure 🔍 -2% - +1% (-0.03ms - +0.01ms)
    preact-local vs preact-main
  • hydrate1k: unsure 🔍 -4% - +4% (-0.42ms - +0.41ms)
    preact-local vs preact-main
  • many-updates: unsure 🔍 -0% - +1% (-0.01ms - +0.02ms)
    preact-local vs preact-main
  • replace1k: unsure 🔍 -1% - +0% (-0.02ms - +0.00ms)
    preact-local vs preact-main
  • text-update: unsure 🔍 +0% - +0% (+0.00ms - +0.00ms)
    preact-local vs preact-main
  • todo: unsure 🔍 -2% - +2% (-0.02ms - +0.03ms)
    preact-local vs preact-main
  • update10th1k: unsure 🔍 -0% - +2% (-0.00ms - +0.06ms)
    preact-local vs preact-main

Results

create10k

duration

VersionAvg timevs preact-localvs preact-main
preact-local925.03ms - 933.66ms-unsure 🔍
-1% - +1%
-7.99ms - +4.90ms
preact-main926.11ms - 935.68msunsure 🔍
-1% - +1%
-4.90ms - +7.99ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local19.18ms - 19.19ms-unsure 🔍
+0% - +0%
+0.00ms - +0.00ms
preact-main19.18ms - 19.18msunsure 🔍
-0% - -0%
-0.00ms - -0.00ms
-
filter-list

duration

VersionAvg timevs preact-localvs preact-main
preact-local16.58ms - 16.70ms-unsure 🔍
-0% - +1%
-0.02ms - +0.12ms
preact-main16.56ms - 16.62msunsure 🔍
-1% - +0%
-0.12ms - +0.02ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local1.53ms - 1.55ms-unsure 🔍
-2% - +1%
-0.03ms - +0.01ms
preact-main1.53ms - 1.57msunsure 🔍
-1% - +2%
-0.01ms - +0.03ms
-
hydrate1k

duration

VersionAvg timevs preact-localvs preact-main
preact-local76.10ms - 77.45ms-unsure 🔍
-1% - +1%
-1.11ms - +0.93ms
preact-main76.10ms - 77.63msunsure 🔍
-1% - +1%
-0.93ms - +1.11ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local9.41ms - 9.98ms-unsure 🔍
-4% - +4%
-0.42ms - +0.41ms
preact-main9.39ms - 10.00msunsure 🔍
-4% - +4%
-0.41ms - +0.42ms
-
many-updates

duration

VersionAvg timevs preact-localvs preact-main
preact-local16.56ms - 16.62ms-unsure 🔍
-1% - +1%
-0.09ms - +0.20ms
preact-main16.39ms - 16.68msunsure 🔍
-1% - +1%
-0.20ms - +0.09ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local3.76ms - 3.79ms-unsure 🔍
-0% - +1%
-0.01ms - +0.02ms
preact-main3.76ms - 3.78msunsure 🔍
-1% - +0%
-0.02ms - +0.01ms
-
replace1k
  • Browser: chrome-headless
  • Sample size: 100
  • Built by: CI #4613
  • Commit: 3bf6ea3

duration

VersionAvg timevs preact-localvs preact-main
preact-local64.97ms - 65.72ms-unsure 🔍
-2% - +0%
-1.40ms - +0.23ms
preact-main65.21ms - 66.66msunsure 🔍
-0% - +2%
-0.23ms - +1.40ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local2.98ms - 2.98ms-unsure 🔍
-1% - +0%
-0.02ms - +0.00ms
preact-main2.98ms - 3.00msunsure 🔍
-0% - +1%
-0.00ms - +0.02ms
-

run-warmup-0

VersionAvg timevs preact-localvs preact-main
preact-local29.81ms - 30.30ms-unsure 🔍
-2% - +1%
-0.48ms - +0.40ms
preact-main29.73ms - 30.46msunsure 🔍
-1% - +2%
-0.40ms - +0.48ms
-

run-warmup-1

VersionAvg timevs preact-localvs preact-main
preact-local34.23ms - 35.48ms-unsure 🔍
-2% - +3%
-0.65ms - +1.06ms
preact-main34.07ms - 35.24msunsure 🔍
-3% - +2%
-1.06ms - +0.65ms
-

run-warmup-2

VersionAvg timevs preact-localvs preact-main
preact-local25.38ms - 25.75ms-unsure 🔍
-3% - +0%
-0.69ms - +0.06ms
preact-main25.55ms - 26.21msunsure 🔍
-0% - +3%
-0.06ms - +0.69ms
-

run-warmup-3

VersionAvg timevs preact-localvs preact-main
preact-local27.15ms - 27.84ms-unsure 🔍
-2% - +1%
-0.62ms - +0.31ms
preact-main27.34ms - 27.96msunsure 🔍
-1% - +2%
-0.31ms - +0.62ms
-

run-warmup-4

VersionAvg timevs preact-localvs preact-main
preact-local27.40ms - 27.95ms-unsure 🔍
-1% - +2%
-0.26ms - +0.64ms
preact-main27.13ms - 27.84msunsure 🔍
-2% - +1%
-0.64ms - +0.26ms
-

run-final

VersionAvg timevs preact-localvs preact-main
preact-local20.11ms - 20.52ms-unsure 🔍
-1% - +2%
-0.29ms - +0.34ms
preact-main20.05ms - 20.53msunsure 🔍
-2% - +1%
-0.34ms - +0.29ms
-
text-update
  • Browser: chrome-headless
  • Sample size: 110
  • Built by: CI #4613
  • Commit: 3bf6ea3

duration

VersionAvg timevs preact-localvs preact-main
preact-local2.05ms - 2.21ms-unsure 🔍
-5% - +4%
-0.11ms - +0.09ms
preact-main2.08ms - 2.19msunsure 🔍
-4% - +5%
-0.09ms - +0.11ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local1.12ms - 1.12ms-unsure 🔍
+0% - +0%
+0.00ms - +0.00ms
preact-main1.12ms - 1.12msunsure 🔍
-0% - -0%
-0.00ms - -0.00ms
-
todo

duration

VersionAvg timevs preact-localvs preact-main
preact-local33.69ms - 33.94ms-unsure 🔍
-1% - +0%
-0.29ms - +0.16ms
preact-main33.70ms - 34.07msunsure 🔍
-0% - +1%
-0.16ms - +0.29ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local1.24ms - 1.27ms-unsure 🔍
-2% - +2%
-0.02ms - +0.03ms
preact-main1.24ms - 1.27msunsure 🔍
-2% - +2%
-0.03ms - +0.02ms
-
update10th1k

duration

VersionAvg timevs preact-localvs preact-main
preact-local32.26ms - 33.43ms-unsure 🔍
-5% - +1%
-1.63ms - +0.37ms
preact-main32.66ms - 34.28msunsure 🔍
-1% - +5%
-0.37ms - +1.63ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local2.99ms - 3.04ms-unsure 🔍
-0% - +2%
-0.00ms - +0.06ms
preact-main2.96ms - 3.01msunsure 🔍
-2% - +0%
-0.06ms - +0.00ms
-

tachometer-reporter-action v2 for CI

Copy link

github-actions bot commented Mar 9, 2025

Size Change: -5 B (-0.01%)

Total Size: 78.5 kB

Filename Size Change
dist/preact.js 4.74 kB -2 B (-0.04%)
dist/preact.min.js 4.76 kB -1 B (-0.02%)
dist/preact.min.module.js 4.77 kB -1 B (-0.02%)
dist/preact.mjs 4.76 kB -1 B (-0.02%)
dist/preact.module.js 4.76 kB -1 B (-0.02%)
dist/preact.umd.js 4.79 kB +1 B (+0.02%)
ℹ️ View Unchanged
Filename Size
compat/dist/compat.js 4.12 kB
compat/dist/compat.mjs 4.05 kB
compat/dist/compat.module.js 4.05 kB
compat/dist/compat.umd.js 4.19 kB
debug/dist/debug.js 3.82 kB
debug/dist/debug.mjs 3.82 kB
debug/dist/debug.module.js 3.82 kB
debug/dist/debug.umd.js 3.9 kB
devtools/dist/devtools.js 260 B
devtools/dist/devtools.mjs 274 B
devtools/dist/devtools.module.js 274 B
devtools/dist/devtools.umd.js 346 B
dist/preact.min.umd.js 4.79 kB
hooks/dist/hooks.js 1.54 kB
hooks/dist/hooks.mjs 1.57 kB
hooks/dist/hooks.module.js 1.57 kB
hooks/dist/hooks.umd.js 1.61 kB
jsx-runtime/dist/jsxRuntime.js 978 B
jsx-runtime/dist/jsxRuntime.mjs 952 B
jsx-runtime/dist/jsxRuntime.module.js 952 B
jsx-runtime/dist/jsxRuntime.umd.js 1.05 kB
test-utils/dist/testUtils.js 473 B
test-utils/dist/testUtils.mjs 477 B
test-utils/dist/testUtils.module.js 477 B
test-utils/dist/testUtils.umd.js 555 B

compressed-size-action

@coveralls
Copy link

Coverage Status

coverage: 99.61%. remained the same
when pulling 3bf6ea3 on revert/force-update-edgecase
into a69aada on main.

@rschristian
Copy link
Member Author

Unfortunately I'm really struggling to come up with a test case that reproduces the behavior minimally. If anyone has suggestions, would love to hear them as perhaps I'm tunnel visioning here.

Tentatively opening this up for review as tests in preact-iso are now passing with this change: https://github.com/preactjs/preact-iso/pull/79/files

@rschristian rschristian marked this pull request as ready for review March 10, 2025 04:52
Copy link
Member

@JoviDeCroock JoviDeCroock left a comment

Choose a reason for hiding this comment

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

This is a good choice yes!

@JoviDeCroock JoviDeCroock merged commit 625aacf into main Mar 10, 2025
15 checks passed
@JoviDeCroock JoviDeCroock deleted the revert/force-update-edgecase branch March 10, 2025 11:02
@JoviDeCroock JoviDeCroock mentioned this pull request Mar 20, 2025
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