aidenybai / million

Optimize React performance and make your React 70% faster in minutes, not months.
https://million.dev
MIT License
16.26k stars 574 forks source link

feat: create a webpack plugin that automatic add the blocks #393

Closed aralroca closed 1 year ago

aralroca commented 1 year ago

It's great that it's just adding a hoc in the components, but maybe we could even make it so that developers don't have to do anything extra other than add a plugin and it automatically adds these blocks in all components. What do you think? If you like the idea I would like to help in its development

tobySolutions commented 1 year ago

It's great that it's just adding a hoc in the components, but maybe we could even make it so that developers don't have to do anything extra other than add a plugin and it automatically adds these blocks in all components. What do you think? If you like the idea I would like to help in its development

Hmm, I like the sound of your idea, can you like explain a use-case for me? Cos, what I'm getting now is that you want block() to be imported automatically right?

itsjayway commented 1 year ago

@aralroca please correct me if I'm wrong, but I'm thinking of a cmd that can be called like a linter, going into each file, importing, and applying the block wrapper

aidenybai commented 1 year ago

This is something we're going to converge to, but we have a lot of work to do before then: stability of the project, bugs, and removing the current limitations. We also need to make it future proof (how it works in a RSC, React Forget, Offscreen Rendering) world

aralroca commented 1 year ago

Perhaps I commented too quickly yesterday without know a lot of Million yet. If to use the new virtual block you have to make all components have the block, then it would make sense to me.

Although now I doubt that it is really so, please correct me if I'm wrong, after thinking a little I understand that if you wrap the parent components that are on top of the pages and the children would use the new virtual dom, or have I misunderstood? If so, then it's not that much work for the developer either.

To be honest, I saw yesterday the existence of this library and I got excited and I haven't tried it yet.

tobySolutions commented 1 year ago

Perhaps I commented too quickly yesterday without know a lot of Million yet. If to use the new virtual block you have to make all components have the block, then it would make sense to me.

Although now I doubt that it is really so, please correct me if I'm wrong, after thinking a little I understand that if you wrap the parent components that are on top of the pages and the children would use the new virtual dom, or have I misunderstood? If so, then it's not that much work for the developer either.

To be honest, I saw yesterday the existence of this library and I got excited and I haven't tried it yet.

Yeah, a good question Aralroca! Well, as you might have heard, the library isn't a silver bullet, as you don't go about having every component be a block. Millionjs at the moment has some use cases where it's best used granularly; Like from the bottom-up as opposed to the way most wrappers in libraries work.

What we have at the moment does make a lot of perf improvements so long as the stipulated rules (which are like limitations we're working actively to get rid of) are followed.

Check out https://million.dev/blog for more information

aidenybai commented 1 year ago

Closed because of #294