Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(mobile): thread links show their thread's title #26485

Mergedjuliusmarmingemerged 2 commits intomain fromrefs/pull/26485/headmerged by juliusmarminge View on GitHub

Showing 2 changed files with 20 additions and 2 deletions.

x
0 of 2 viewed, 2 left
17 additions and 1 deletionpackages/shared/src/threadLinks.test.tsModified
View file
@@ -1,4 +1,4 @@
-import { describe, expect, it } from "vite-plus/test";
+import { describe, expect, it, vi } from "vite-plus/test";
import { EnvironmentId, ThreadId, type ScopedThreadRef } from "@t3tools/contracts";
​
import {
@@ -143,6 +143,22 @@
).toEqual([ref("there", "t1"), ref("local", "t%3A2"), ref("local", "t:2")]);
});
​
+ it("lists a message's thread links on runtimes whose matchAll omits named groups, such as Hermes", () => {
+ const matchAll = String.prototype.matchAll;
+ using _hermes = vi.spyOn(String.prototype, "matchAll").mockImplementation(function (
+ this: string,
+ regexp: RegExp,
+ ) {
+ return matchAll.call(this, regexp).map((match) => {
+ delete match.groups;
+ return match;
+ });
+ });
+ expect(threadLinkRefs("<t3-thread://v2/local/t1> [a](t3-thread://v2/there/t2)", local)).toEqual(
+ [ref("local", "t1"), ref("there", "t2")],
+ );
+ });
+​
it("writes a titleless autolink that opens that exact thread", () => {
const link = formatThreadLink(ref("env-1", "thread:delegated-task:mcp%3A1"));
expect(link).toBe("<t3-thread://v2/env-1/thread:delegated-task:mcp%3A1>");