xyflow / xyflow

React Flow | Svelte Flow - Powerful open source libraries for building node-based UIs with React (https://reactflow.dev) or Svelte (https://svelteflow.dev). Ready out-of-the-box and infinitely customizable.
https://xyflow.com
MIT License
21.84k stars 1.45k forks source link

Mini Map preview disappeared in 12.0.0-next.18 #4279

Closed dAN0n closed 2 weeks ago

dAN0n commented 2 weeks ago

Describe the Bug

Hi, I suppose mini map preview was somehow broken after upgrade from 12.0.0-next.17 to 12.0.0-next.18. Zooming and dragging works but without any elements inside, just gray square with white viewport.

Your Example Website or App

https://stackblitz.com/edit/vitejs-vite-2bl2pz?file=src%2FApp.jsx

Steps to Reproduce the Bug or Issue

  1. The bug is visible in example app
  2. On xyflow/react 12.0.0-next.17 mini map works as intended.

Expected behavior

Mini map has a graph preview.

Screenshots or Videos

12.0.0-next.18 puush-linux+(2024-05-15+at+02 27 08) 12.0.0-next.17 puush-linux+(2024-05-15+at+02 27 54)

Platform

Additional context

No response

peterkogo commented 2 weeks ago

You forgot to add onNodesChange and onEdgesChange handler. Plus, the nesting you are doing is not recommended and will result in weird side effects. Here is a corrected sanbox.