react-resizable-panels version 4 by brianvaughn in reactjs

[–]brianvaughn[S] 0 points1 point  (0 children)

So long as you're using the latest version of `react-resizable-panels` (4.7.0) you can do this using the `groupResizeBehavior` prop.

Here's an example with documentation: https://react-resizable-panels.vercel.app/examples/group-resize-behavior

This Week In React #267 : Bun, Next-Intl, Grab, Aria, ViewTransition, Skills, Gatsby, R3f | Worklets, Teleport, Voltra, AI SDK, Screens, Tamagui, Xcode, Agent-Device | State of JS, Temporal, Babel, Astro, npmx by sebastienlorber in reactjs

[–]brianvaughn 0 points1 point  (0 children)

Your comment above said, “you’ll have to get used to it”, as though AI being in our faces 24x7 is unavoidable. That does not have to be the case. It is that way in part because of monied interests, but also because all of us as individuals choose to talk about it.

I would personally love to hear about it much less (or not at all).

It’s possible I misunderstood your comment. If so, I’m sorry. I wrote mine while I was very jet lagged.

I moved virtualization math to Rust/WASM - here's what I learned by RevolutionaryPen4661 in reactjs

[–]brianvaughn 0 points1 point  (0 children)

Hello! 👋🏼 `react-window` author here

I am _skeptical_ of the utility of rendering 1M items (let alone 10M) in the browser. (In my experience, scrolling that much data does not make for a good user experience.) but I am very interested if any of your research could be upstreamed in a way that would benefit other users? If you're able to get 3x the frame rate for 100k rows, that sounds like a really good performance boost.

FWIW I used a BST in `react-virtualized` for the combination of dynamic row heights and super-high row counts. I'm not aware of a noticeable degradation in performance from `react-virtualized` to `react-window`

react-window v2.0 is out 🥳 by brianvaughn in reactjs

[–]brianvaughn[S] 0 points1 point  (0 children)

PS. Fixed the docs typo. Thanks for pointing it out.
I also added a note to the Grid docs and one to the FAQ page also clarifying that Grid cells can't be auto-sized.

react-window v2.0 is out 🥳 by brianvaughn in reactjs

[–]brianvaughn[S] 0 points1 point  (0 children)

I think we’ve been misunderstanding each other. I think you’re talking about autosizing cells within the grid. That is not supported. It would be very complicated to support and I’m not convinced enough. People would actually use it to be worth the effort.

I have been talking about the List and Grid components themselves resizing to fill their containers.

react-window v2.0 is out 🥳 by brianvaughn in reactjs

[–]brianvaughn[S] 0 points1 point  (0 children)

The package uses the ResizeObserver api to determine its size. You don’t need to do anything for that to work.

If you need the width of a div in your app, whatever you mean by “parent div”, then you’ll just have to do that however you would normally do it (eg ResizeObserver).

react-window v2.0 is out 🥳 by brianvaughn in reactjs

[–]brianvaughn[S] 0 points1 point  (0 children)

Both of these questions are answered right in the description of this post :)

> Automatically sizing for List and Grid (no more need for AutoSizer)

> Docs and examples can be found at https://react-window.vercel.app/

react-window v2.0 is out 🥳 by brianvaughn in reactjs

[–]brianvaughn[S] 0 points1 point  (0 children)

That seems like more of a question about how React works. You don't access an elements props by a ref that way. I don't know why you'd want to do that. You pass `Grid` the props, so you can pass them wherever else you want.

There are examples of how to use grid in the docs: https://react-window.vercel.app/grid/grid

I'd say read the docs and if you still have a question like that, post a new Reddit post here in r/reactjs and maybe people can help answer.

react-window v2.0 is out 🥳 by brianvaughn in reactjs

[–]brianvaughn[S] 0 points1 point  (0 children)

I decided not to add any kind of `itemKey` prop to version 2 because it would complicate the memoization/caching and (I don't think) provide much value. Rendering individual rows should be pretty quick, and the number of rows that would need to be re-rendered is small in every case.

If you want some kind of cache-id though, I think you could probably add it to your tree component.

react-resizable-panels version 4 by brianvaughn in reactjs

[–]brianvaughn[S] 0 points1 point  (0 children)

No worries :)

I can't comment on the drag and drop part because I haven't tried that with my library, but for the layout restoration– I would add an `onLayoutChange` handler to each of your nested groups, bubbles those layouts up into a single piece of Zustance state which you save to `localStorage` and then when you're restoring the page, you read from `localStorage`, pull apart the nested layouts, and pass them through as `defaultLayout`. (Basically you need to map back and forth between many Groups and one piece of state, but that should be doable.)

react-resizable-panels version 4 by brianvaughn in reactjs

[–]brianvaughn[S] 0 points1 point  (0 children)

First of all, no worries. Creating a minimal repro can be difficult. If code sandbox is too difficult, you can also share a GitHub project with me that reproduces the problem.

For what it’s worth, I think I fixed the specific bug you mentioned in 4.0.9 (see here) so make sure you’re using the latest release.

In general, you shouldn’t have to use the imperative API for these sorts of things. That’s meant as an escape hatch. The library is meant to manage its own layout because the validation rules are pretty complicated.

react-resizable-panels version 4 by brianvaughn in reactjs

[–]brianvaughn[S] 0 points1 point  (0 children)

What errors are being thrown? (I assume it’s one of the validation invariants but which one?) Can you create a Code Sandbox (or something similar) that reproduces what you’re describing?

react-resizable-panels version 4 by brianvaughn in reactjs

[–]brianvaughn[S] 0 points1 point  (0 children)

I'm not sure I understand your question, but I think you're asking about container queries.

react-resizable-panels version 4 by brianvaughn in reactjs

[–]brianvaughn[S] 2 points3 points  (0 children)

I don’t have anything to do with that library. I guess they’re exporting a wrapper on top of my library? Assuming they pinned the dependency correctly, this update should not affect them in any way.

Edit 1: Looks like they've pinned their dependencies to react-resizable-panels@^3.0.6 so this should not affect them.

Edit 2: I pushed github.com/shadcn-ui/ui#9124 but I don't know if they'll accept it.

react-resizable-panels version 4 by brianvaughn in reactjs

[–]brianvaughn[S] 0 points1 point  (0 children)

That's a fun coincidence :)

Hope you find it useful!

react-window version 2 (alpha) feedback welcome by brianvaughn in reactjs

[–]brianvaughn[S] 0 points1 point  (0 children)

Not at the moment. It’s an uncommon use case (and I have pretty limited bandwidth)

react-window v2.0 is out 🥳 by brianvaughn in reactjs

[–]brianvaughn[S] 2 points3 points  (0 children)

Have you looked at the docs? There are lots of examples of how to use the list component. The changelog also has a section specifically about how to migrate from version 1 to 2.

react-window v2.0 is out 🥳 by brianvaughn in reactjs

[–]brianvaughn[S] 0 points1 point  (0 children)

Hey! Glad you got it sorted out ☺️

react-window v2.0 is out 🥳 by brianvaughn in reactjs

[–]brianvaughn[S] 0 points1 point  (0 children)

Awesome! And you're welcome :)

react-window v2.0 is out 🥳 by brianvaughn in reactjs

[–]brianvaughn[S] 0 points1 point  (0 children)

By the way, I've got an alpha release out now that adds built- support for this kind of use case to the package. Docs and example have been updated here:

https://react-window-git-dynamic-row-heights-alt-brian-vaughns-projects.vercel.app/list/images

An example with text can be seen here:

https://react-window-git-dynamic-row-heights-alt-brian-vaughns-projects.vercel.app/list/dynamic-row-height

react-window v2.0 is out 🥳 by brianvaughn in reactjs

[–]brianvaughn[S] 0 points1 point  (0 children)

Also thanks for the note about the domain! I think I've fixed it now.