diff --git a/packages/insomnia/src/routes/organization.$organizationId.project.$projectId._index.tsx b/packages/insomnia/src/routes/organization.$organizationId.project.$projectId._index.tsx
index bf5560dbe0..1e3fe2841a 100644
--- a/packages/insomnia/src/routes/organization.$organizationId.project.$projectId._index.tsx
+++ b/packages/insomnia/src/routes/organization.$organizationId.project.$projectId._index.tsx
@@ -141,7 +141,7 @@ const Component = ({ loaderData }: Route.ComponentProps) => {
const [isNewProjectModalOpen, setIsNewProjectModalOpen] = useState(false);
const [isUpdateProjectModalOpen, setIsUpdateProjectModalOpen] = useState(false);
const organization = organizationData?.organizations.find(o => o.id === organizationId);
- const isUserOwner = organization && userSession.accountId && Boolean(organization.is_owner);
+ const isUserOwner = Boolean(organization?.is_owner);
const collectionItems = useMemo(
() =>
localFiles
diff --git a/packages/insomnia/src/ui/components/first-request-creation.tsx b/packages/insomnia/src/ui/components/first-request-creation.tsx
index 609d688736..c05a09f867 100644
--- a/packages/insomnia/src/ui/components/first-request-creation.tsx
+++ b/packages/insomnia/src/ui/components/first-request-creation.tsx
@@ -246,6 +246,7 @@ export const FirstRequestCreation = ({
const handleCreateRequest = async () => {
if (!trimmedInput) {
+ handleCreateBlankRequest();
return;
}
const workspaceId = await ensureWorkspaceId();
@@ -301,6 +302,13 @@ export const FirstRequestCreation = ({
setSelectOpen(false);
}, [selectedCollectionId]);
+ // Focus the request input whenever the pane is (re-)shown for a project. A plain
+ // `autoFocus` attribute only fires on the input's initial DOM mount, so it misses
+ // client-side navigations between projects that reuse this component instance.
+ useEffect(() => {
+ inputRef.current?.focus();
+ }, [projectId]);
+
// Load the lifetime created-request count, used to decide when to latch the
// server-side graduation threshold (see maybeLatchRequestThreshold for how the
// device-wide count is scoped back down to this account).
@@ -324,18 +332,20 @@ export const FirstRequestCreation = ({
useEffect(() => {
let isActive = true;
- getCurrentSessionId()
- .then(sessionId => (sessionId ? getOnboardingState({ sessionId }) : null))
- .catch(error => {
+ const loadOnboardingState = async () => {
+ let state: UserOnboarding | null = null;
+ try {
+ const sessionId = await getCurrentSessionId();
+ state = sessionId ? await getOnboardingState({ sessionId }) : null;
+ } catch (error) {
console.error('Failed to load onboarding state', error);
- return null;
- })
- .then(state => {
- if (isActive) {
- setOnboarding(state);
- setOnboardingLoaded(true);
- }
- });
+ }
+ if (isActive) {
+ setOnboarding(state);
+ setOnboardingLoaded(true);
+ }
+ };
+ loadOnboardingState();
return () => {
isActive = false;
@@ -543,7 +553,6 @@ export const FirstRequestCreation = ({
handleCreateRequest()}
>
{createButtonLabel}