Skip to content

fix(task-input): respect folderId when pre-selecting directory#2178

Closed
oliverb123 wants to merge 2 commits into
mainfrom
posthog-code/fix-new-task-prefill-project-repo
Closed

fix(task-input): respect folderId when pre-selecting directory#2178
oliverb123 wants to merge 2 commits into
mainfrom
posthog-code/fix-new-task-prefill-project-repo

Conversation

@oliverb123
Copy link
Copy Markdown
Contributor

Summary

  • Clicking the + beside a project in the task sidebar passes that project's folderId to the new-task view, but the directory was still being pre-filled with the most-recently-accessed repo.
  • Two effects in TaskInput raced to initialize selectedDirectory: a fallback to mostRecentRepo.path and a lookup driven by view.folderId. When folders hadn't loaded yet on first render, the fallback fired first and the folderId lookup never overrode it.
  • Skip the fallback when view.folderId is set so the folder lookup is the sole source of truth in that case. Behavior is unchanged when no folder context is provided.

Test plan

  • Start a task in Project A so it becomes the most-recently-accessed repo.
  • Click the + beside Project B in the sidebar — the new-task UI should pre-select Project B's directory, not Project A's.
  • Reverse the roles and repeat to confirm.
  • Open the new-task UI from a global entry point (no folder context) — it should still pre-select the most-recent repo.

Clicking the "+" beside a project in the sidebar passes that project's
folderId to the new-task view, but the directory fallback effect would
race with the folderId effect and pre-fill the most-recently-accessed
repo instead. Skip the fallback when an explicit folderId is present so
the folder lookup is the sole source of truth.

Generated-By: PostHog Code
Task-Id: 70c8762e-5b7b-4699-96fd-ce73f379ee2b
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 18, 2026

Reviews (1): Last reviewed commit: "fix(task-input): respect folderId when p..." | Re-trigger Greptile

In cloud workspace mode the visible repo is driven by `selectedRepository`
(derived to `selectedCloudRepository`), which was initialized from
`lastUsedCloudRepository` and never reacted to `view.folderId`. Extend the
folderId effect to also set the cloud repo from `folder.remoteUrl` (using
`normalizeRepoKey`) and persist it via `setLastUsedCloudRepository`, so
the cloud picker shows the project the user actually clicked.

`workspaceMode` is intentionally left untouched — both modes now reflect
the clicked project; the user's mode preference is preserved.

Generated-By: PostHog Code
Task-Id: 70c8762e-5b7b-4699-96fd-ce73f379ee2b
@oliverb123 oliverb123 closed this May 18, 2026
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.

1 participant