Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for long message IDs that break the UI #555

Merged
merged 2 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions __tests__/app/message-table.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,31 @@ describe("MessageTable", () => {
expect(defaultAboutWelcomeMsg).toBeInTheDocument();
});
});

it("truncates message ID if it's over 50 characters long", () => {
const messageId =
"12345678901234567890123456789012345678901234567890 is 50 characters long";
const fakeMsgInfo: FxMSMessageInfo = {
product: "Desktop",
id: messageId,
template: "test template",
surface: "test surface",
segment: "test segment",
metrics: "test metrics",
ctrDashboardLink: "test link",
};
render(
<MessageTable columns={fxmsMessageColumns} data={[fakeMsgInfo]} />,
);

const message = screen.queryByText(messageId);
const truncatedMessage = screen.queryByText(
"12345678901234567890123456789012345678901234567890…",
);

expect(message).not.toBeInTheDocument();
expect(truncatedMessage).toBeInTheDocument();
});
});

describe("CompletedExperimentColumns", () => {
Expand Down
5 changes: 4 additions & 1 deletion app/columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,10 @@ export const fxmsMessageColumns: ColumnDef<FxMSMessageInfo>[] = [
return (
<>
<div className="font-mono text-xs inline">
{props.row.original.id}
{/* Quick fix for long message IDs that can break the UI */}
{props.row.original.id.length <= 50
? props.row.original.id
: props.row.original.id.substring(0, 50) + "…"}
</div>
{props.row.original.hasMicrosurvey && <> {microsurveyBadge} </>}
</>
Expand Down
Loading