RocketChat / RocketChat/Rocket.Chat
fix(uikit-playground): activeScreen and activeProject not updated correctly after deletion
Nobody has claimed this yet.
- 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
- Open the UIKit Playground.
- Create a project with two or more screens.
- Make one of the screens the active screen.
- Delete the currently active screen.
- Observe that
activeScreendoes not update to a valid remaining screen. - Delete all screens from a project.
- Observe that the project persists in state as an empty entry instead of being removed.
Expected Behavior
- After deleting the active screen,
activeScreenshould automatically update to point to a valid remaining screen. - After deleting the active project,
activeProjectshould 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
activeScreenandactiveProjectcontinue 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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