nolanlawson / emoji-picker-element

A lightweight emoji picker for the modern web
https://nolanlawson.github.io/emoji-picker-element/
Apache License 2.0
1.44k stars 82 forks source link

fix: preserve state if component disconnects then immediately reconnects #313

Closed nolanlawson closed 1 year ago

nolanlawson commented 1 year ago

Fixes #312

github-actions[bot] commented 1 year ago

📊 Tachometer Benchmark Results

Summary

benchmark-total

  • emoji-picker-element-database-interactions: unsure 🔍 -4% - +4% (-8.13ms - +6.41ms)
    this-change vs tip-of-tree
  • emoji-picker-element-first-load: unsure 🔍 -6% - +9% (-4.43ms - +6.48ms)
    this-change vs tip-of-tree
  • emoji-picker-element-second-load: unsure 🔍 -9% - +4% (-6.91ms - +3.09ms)
    this-change vs tip-of-tree

Results

emoji-picker-element-database-interactions
  • Browser: chrome-headless 109.0.5414.74
  • Sample size: 50
  • Built by: Benchmarks #218
  • Commit: 80abbd3
VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
this-change
175.89ms - 185.32ms-unsure 🔍
-4% - +4%
-8.13ms - +6.41ms
tip-of-tree
tip-of-tree
175.93ms - 187.00msunsure 🔍
-4% - +5%
-6.41ms - +8.13ms
-
emoji-picker-element-first-load
  • Browser: chrome-headless 109.0.5414.74
  • Sample size: 60
  • Built by: Benchmarks #218
  • Commit: 80abbd3
VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
this-change
67.07ms - 74.98ms-unsure 🔍
-6% - +9%
-4.43ms - +6.48ms
tip-of-tree
tip-of-tree
66.24ms - 73.76msunsure 🔍
-9% - +6%
-6.48ms - +4.43ms
-
emoji-picker-element-second-load
  • Browser: chrome-headless 109.0.5414.74
  • Sample size: 90
  • Built by: Benchmarks #218
  • Commit: 80abbd3
VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
this-change
72.45ms - 79.40ms-unsure 🔍
-9% - +4%
-6.91ms - +3.09ms
tip-of-tree
tip-of-tree
74.24ms - 81.43msunsure 🔍
-4% - +9%
-3.09ms - +6.91ms
-

tachometer-reporter-action v2 for Benchmarks

github-actions[bot] commented 1 year ago

Size Change: +76 B (0%)

Total Size: 42.4 kB

Filename Size Change
./bundle.js 42.4 kB +76 B (0%)

compressed-size-action

nolanlawson commented 1 year ago

Interestingly not all state can be saved, but this is mostly a browser problem. E.g. if the skintone picker is expanded, then remove+append will collapse it, because the blur event fires. And scroll state is also not restored.

But everything else is restored and seems to work well after document.body.removeChild(picker); document.body.appendChild(picker). So this seems like a decent change.