RocketChat / RocketChat/Rocket.Chat

fix(uikit-playground): activeScreen and activeProject not updated correctly after deletion

Open
#39,240 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: bug
Dominant language
TypeScript
Stars
46.1k
Forks
13.9k
Avg merge
3d 3h
Merged PRs (30d)
130

Description

Description

When deleting a screen or project in the UIKit Playground, the activeScreen and activeProject state values are not correctly updated, causing the UI to reflect stale or invalid state after the deletion.

Steps to Reproduce

  1. Open the UIKit Playground.
  2. Create a project with two or more screens.
  3. Make one of the screens the active screen.
  4. Delete the currently active screen.
  5. Observe that activeScreen does not update to a valid remaining screen.
  6. Delete all screens from a project.
  7. Observe that the project persists in state as an empty entry instead of being removed.

Expected Behavior

  • After deleting the active screen, activeScreen should automatically update to point to a valid remaining screen.
  • After deleting the active project, activeProject should update accordingly.
  • If all screens in a project are deleted, the project itself should be automatically removed from state.
  • The UI should always reflect accurate, current state after any deletion operation.

Actual Behavior

  • activeScreen and activeProject continue to reference the deleted item or resolve incorrectly.
  • Empty projects (with no remaining screens) persist in state after their last screen is deleted.
  • The UI does not update correctly, leaving the user with a broken or inconsistent view.

Root Cause (Investigated)

The reducer recalculates active state before removing the target screen from the list. This means the recalculation runs on stale data — the deleted screen is still present during index resolution — resulting in incorrect activeScreen and activeProject values.

Environment

  • App: UIKit Playground
  • Area: State management / reducer logic

Additional Context

No external dependencies are affected. The issue is isolated to the deletion reducer logic within the Playground.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the UIKit Playground deletion reducer and reproduce the screen and project deletion cases described in the issue. Inspect how active state is recalculated relative to removal, then verify that deleting the active screen selects a valid remaining screen, deleting the active project updates state, and removing the last screen removes the empty project.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.