Skip to content

Fix group visibility not updating in viewport after undo/redo (#3335)#3359

Open
phatgolo wants to merge 2 commits intoJannisX11:nextfrom
phatgolo:fix/group-visibility-undo-redo-3335
Open

Fix group visibility not updating in viewport after undo/redo (#3335)#3359
phatgolo wants to merge 2 commits intoJannisX11:nextfrom
phatgolo:fix/group-visibility-undo-redo-3335

Conversation

@phatgolo
Copy link

@phatgolo phatgolo commented Mar 2, 2026

Fix group visibility not updating in viewport after undo/redo (#3335)

Problem

When toggling group visibility in the outliner after an undo/redo cycle, elements inside the group remain invisible in the 3D viewport even though the outliner shows them as visible.

Two issues contribute to this:

  1. Canvas.updateVisibility() only updates element mesh visibility — it never syncs group mesh visibility, so toggling a group's eye icon doesn't propagate to the 3D scene.
  2. The outliner drag-toggle's undo handler (Undo.initEdit) used a separate affected_groups array that only tracked directly targeted groups, missing any child groups toggled via forEachChild. This caused undo/redo to leave group visibility state inconsistent.

Changes

  • canvas.js: Update group mesh visibility in Canvas.updateVisibility() to match each group's visibility property.
  • outliner.js: Replace the incomplete affected_groups tracking with affected.filter(node => node instanceof Group), which correctly captures all affected groups including children. Remove the now-unused affected_groups variable.

Fixes #3335

@netlify
Copy link

netlify bot commented Mar 2, 2026

Deploy Preview for blockbench-dev ready!

Name Link
🔨 Latest commit e5b4964
🔍 Latest deploy log https://app.netlify.com/projects/blockbench-dev/deploys/69a578a271422e0009b276f7
😎 Deploy Preview https://deploy-preview-3359--blockbench-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@phatgolo phatgolo changed the title Fix/group visibility undo redo 3335 Fix group visibility not updating in viewport after undo/redo (#3335) Mar 2, 2026
@juan3178316
Copy link

Yeah 🥳

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.

2 participants