Skip to content
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

refactor: preact v1 #95

Merged
merged 14 commits into from
Dec 16, 2024
Merged

refactor: preact v1 #95

merged 14 commits into from
Dec 16, 2024

Conversation

pivanov
Copy link
Collaborator

@pivanov pivanov commented Dec 9, 2024

🎯 V1 (WIP)

Changes

  • Restructured toolbar layout for better UX
  • Optimized resize performance with debounced updates
  • Added smooth animations for toolbar transitions
  • Improved props container positioning and width handling

Performance Improvements

  • Debounced resize operations to reduce layout thrashing
  • Optimized animation transitions
  • Improved DOM manipulation efficiency

Technical Implementation

  • Shadow DOM encapsulation for styles and scripts isolation
  • Tailwind
  • SVG sprite system for optimized icon loading

Bundle Size Optimization 📦

  • Reduced total bundle size from 3.4MB to 2.3MB (-32%)
  • Optimized individual bundles:
    • monitor/index.js: 124KB → 89KB (-28%)
    • params/remix.global.js: 432KB → 256KB (-41%)
    • params/next.global.js: 246KB → 149KB (-39%)
    • Main bundles: 116KB → 85KB (-27%)

Technical Improvements

  • Enhanced tree-shaking configuration
  • Enabled production minification
  • Optimized dependency externalization
  • Improved code splitting strategy

These optimizations result in faster load times and better runtime performance while maintaining full functionality. 🥳

@pivanov pivanov requested a review from aidenybai December 9, 2024 06:54
Copy link

vercel bot commented Dec 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-scan ❌ Failed (Inspect) Dec 12, 2024 3:23am

Copy link

vercel bot commented Dec 9, 2024

@pivanov is attempting to deploy a commit to the Million Team on Vercel.

A member of the Team first needs to authorize it.

@pivanov
Copy link
Collaborator Author

pivanov commented Dec 9, 2024

Also, I found that the rerender counter wasn't working before this PR.
So dc005a8 fix it 🚀

Before fix:
image

After fix:
image

@RobPruzan
Copy link
Collaborator

I get

TypeError: Cannot read properties of undefined (reading '__H')
    at __H (node_modules/.pnpm/[email protected]/node_modules/preact/hooks/src/index.js:148:18)
    at getHookState (node_modules/.pnpm/[email protected]/node_modules/preact/hooks/src/index.js:281:15)
    at ye (node_modules/.pnpm/react-scan@file+..+pivanov+react-scan+packages+scan+react-scan-0.0.48.tgz_next@15.0.4_@babel+_7rcfaor4b4hxpynt5fowhl3g3m/node_modules/react-scan/dist/core/monitor/params/next.mjs:30:14466)
  146 |         // * https://codesandbox.io/s/mnox05qp8
  147 |         const hooks =
> 148 |                 currentComponent.__hooks ||
      |                                ^
  149 |                 (currentComponent.__hooks = {
  150 |                         _list: [],
  151 |                         _pendingEffects: []
TypeError: Cannot read properties of undefined (reading '__H')

when trying to run the branch

return;

const focusedDomElement = currentState.focusedDomElement;
const allElements = Array.from(document.querySelectorAll('*')).filter(
Copy link
Owner

Choose a reason for hiding this comment

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

this is a pretty expensive operation

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah .. this was from the original implementation I will fix it we have also other issues with prev and next buttons

bin/certs/cert.pem Outdated Show resolved Hide resolved
bin/certs/key.pem Outdated Show resolved Hide resolved
@RobPruzan
Copy link
Collaborator

image

when running on next.js, from:
var signalWidget = signal2((() => {
const stored = readLocalStorage(LOCALSTORAGE_KEY);
const maxWidth = window.innerWidth - SAFE_AREA * 2;
const maxHeight = window.innerHeight - SAFE_AREA * 2;

@RobPruzan
Copy link
Collaborator

image

hover style applied to wrong element

@RobPruzan
Copy link
Collaborator

Okay i think i get why the animation feels choppy, the text rendering behavior is a bit off. It kinda just appears arbitrarily during the animation.

I think it would look smooth if its always rendered, and just overflowed hidden on the way up

image image

also, this overflow shouldn't happen
image

@pivanov
Copy link
Collaborator Author

pivanov commented Dec 16, 2024

All bugs was fixed (I hope so)

@pivanov pivanov merged commit 882c87e into aidenybai:main Dec 16, 2024
2 of 3 checks passed
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.

4 participants