MCPcopy Index your code
hub / github.com/codeaashu/claude-code / stickyPromptText

Function stickyPromptText

src/components/VirtualMessageList.tsx:133–144  ·  view source on GitHub ↗
(msg: RenderableMessage)

Source from the content-addressed store, hash-verified

131 */
132const promptTextCache = new WeakMap<RenderableMessage, string | null>();
133function stickyPromptText(msg: RenderableMessage): string | null {
134 // Cache keyed on message object — messages are append-only and don't
135 // mutate, so a WeakMap hit is always valid. The walk (StickyTracker,
136 // per-scroll-tick) calls this 5-50+ times with the SAME messages every
137 // tick; the system-reminder strip allocates a fresh string on each
138 // parse. WeakMap self-GCs on compaction/clear (messages[] replaced).
139 const cached = promptTextCache.get(msg);
140 if (cached !== undefined) return cached;
141 const result = computeStickyPromptText(msg);
142 promptTextCache.set(msg, result);
143 return result;
144}
145function computeStickyPromptText(msg: RenderableMessage): string | null {
146 let raw: string | null = null;
147 if (msg.type === 'user') {

Callers 1

StickyTrackerFunction · 0.85

Calls 3

computeStickyPromptTextFunction · 0.85
getMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected