fix: lock up top edge of the composer so suggestions list doesn't jump #2443
Open
szymeo wants to merge 2 commits into
Open
fix: lock up top edge of the composer so suggestions list doesn't jump #2443szymeo wants to merge 2 commits into
szymeo wants to merge 2 commits into
Conversation
- page navigation slides horizontally with mode="wait" so the panel no longer jumps from two pages briefly stacking in the layout - dropped overflow-hidden so sliding rows are no longer clipped at the edges - card dismiss scales down and fades with a synced layout shift - center the task composer and anchor the suggestions panel below it - add a dev-only suggestion simulation harness gated by VITE_SIMULATE_SUGGESTIONS / a localStorage flag
Contributor
Prompt To Fix All With AIFix the following 2 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 2
apps/code/src/renderer/features/setup/hooks/useSetupDiscovery.ts:27-30
Missing cleanup for the simulation interval. If `selectedDirectory` transitions from a real path to `null`/`undefined`, React re-runs the effect and exits early at `if (!selectedDirectory) return;` — the `startSuggestionSimulation` call that would have cleared the old timer is never reached. The interval keeps firing and accumulates tasks in the store for a directory that is no longer active. The normal non-simulation code path avoids this by returning a cleanup function.
```suggestion
if (shouldSimulateSuggestions()) {
service.startSuggestionSimulation(selectedDirectory);
return () => {
service.stopSuggestionSimulation();
};
}
```
### Issue 2 of 2
apps/code/src/renderer/features/setup/services/setupRunService.ts:312-325
The simulation interval runs forever and has no upper bound. Because every tick uses a unique id (`simulated-suggestion-${index}`), `addDiscoveredTaskIfMissing` never deduplicates and the `discoveredTasks` array in the store grows without limit. Since the purpose of the harness is to exercise the incoming-suggestions animation, capping it (e.g. after one full cycle through all categories) would make the simulation repeatable and predictable.
```suggestion
const totalSuggestions = SIMULATED_SUGGESTION_CATEGORIES.length * 2;
const addNextSuggestion = () => {
useSetupStore
.getState()
.addDiscoveredTaskIfMissing(
buildSimulatedSuggestion(directory, this.simulatedSuggestionsCount),
);
this.simulatedSuggestionsCount += 1;
if (this.simulatedSuggestionsCount >= totalSuggestions) {
this.stopSuggestionSimulation();
}
};
addNextSuggestion();
this.simulatedSuggestionsTimer = window.setInterval(
addNextSuggestion,
SIMULATED_SUGGESTION_INTERVAL_MS,
);
```
Reviews (1): Last reviewed commit: "feat: smoother suggested-tasks list anim..." | Re-trigger Greptile |
Author
|
Resolved both Greptile comments in |
Contributor
|
@PostHog/team-posthog-code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
before.mp4
When new suggestions were added, centered content was jumping vertically, so the rows shifted under the cursor. While trying out a suggestion I ended up misclicking and starting a task I didn't intend to, which is easy to do on a surface people use to kick off work.
Changes
after.mp4
A small UI fix to keep the suggestions list stable and harder to misclick:
VITE_SIMULATE_SUGGESTIONS=1env or theposthog-code:simulate-suggestionslocalStorage flag) so this can be exercised locally without waiting on real discovery.How did you test this?
pnpm --filter code typecheckand Biome pass (also enforced by the pre-commit hook).Automatic notifications