GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(web): project name field restores the saved name when cleared (#4… · pingdotgg/t3code@c8014ad

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/web/src/components/settings
    • ProjectSettingsPanel.browser.test.tsx
    • ProjectSettingsPanel.tsx
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/web/src/components/settings/ProjectSettingsPanel.browser.test.tsx‎

Copy file name to clipboardExpand all lines: apps/web/src/components/settings/ProjectSettingsPanel.browser.test.tsx
+20Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,3 +831,23 @@ describe("project name composition", () => {
831831
]);
832832
});
833833
});
834+
835+
it("shows the saved project name again after an empty name is rejected", async () => {
836+
setup();
837+
await using screen = await mountPanel();
838+
const input = nameInput(screen);
839+
840+
await userEvent.fill(input, " ");
841+
await userEvent.keyboard("{Enter}");
842+
843+
await expect.element(input).toHaveValue("Shared repo");
844+
expect(state.toast).toHaveBeenCalledWith({
845+
type: "warning",
846+
title: "Project title cannot be empty",
847+
});
848+
849+
await userEvent.click(input);
850+
await userEvent.keyboard("{Tab}");
851+
expect(state.toast).toHaveBeenCalledOnce();
852+
expect(state.update).not.toHaveBeenCalled();
853+
});
Collapse file

‎apps/web/src/components/settings/ProjectSettingsPanel.tsx‎

Copy file name to clipboardExpand all lines: apps/web/src/components/settings/ProjectSettingsPanel.tsx
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -318,9 +318,10 @@ function ProjectDetail({
318318
setIsOrganizing(false);
319319
};
320320

321-
const renameGroup = async (nextTitle: string, wasEdited: boolean) => {
322-
const title = nextTitle.trim();
321+
const renameGroup = async (input: HTMLInputElement, wasEdited: boolean) => {
322+
const title = input.value.trim();
323323
if (!title) {
324+
input.value = group.displayName;
324325
toastManager.add({ type: "warning", title: gt("Project title cannot be empty") });
325326
return;
326327
}
@@ -588,7 +589,7 @@ function ProjectDetail({
588589
onBlur={(event) => {
589590
const wasEdited = projectNameEditedRef.current;
590591
projectNameEditedRef.current = false;
591-
void renameGroup(event.currentTarget.value, wasEdited);
592+
void renameGroup(event.currentTarget, wasEdited);
592593
}}
593594
onKeyDown={(event) => {
594595
if (event.nativeEvent.isComposing || event.keyCode === 229) return;

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.