Audit finding from #300 (commit 679f9fe)
Severity: high
Category: performance / bug
File: crates/web/src/app.rs:341
Obvious fix: no
Description
The Effect at app.rs:341 reads messages_sig.get() (current-channel messages) and calls search.rebuild(indexable), which drops the index and re-inserts every message (each insert clones the full Posting per token — see GEN-03). On every send / receive / edit, the entire index is destroyed and rebuilt synchronously on the WASM main thread. Worse: the comment claims indexing is global, but the effect only feeds in the current channel's messages (current_channel_sig derived list); switching channels wipes the index for the previous channel.
Impact / Threat
User-facing — every keystroke that arrives over the wire causes a UI stutter; cross-channel search is broken (results vanish when you switch away).
Suggested fix
Use the existing incremental_insert path on MessageReceived events; subscribe at the client-event stream level instead of the rendered-message signal. Hydrate once on bootstrap.
Verify
rg "search\.rebuild\(indexable\)" crates/web/src/app.rs
Audit finding from #300 (commit 679f9fe)
Severity: high
Category: performance / bug
File: crates/web/src/app.rs:341
Obvious fix: no
Description
The Effect at app.rs:341 reads
messages_sig.get()(current-channel messages) and callssearch.rebuild(indexable), which drops the index and re-inserts every message (each insert clones the full Posting per token — see GEN-03). On every send / receive / edit, the entire index is destroyed and rebuilt synchronously on the WASM main thread. Worse: the comment claims indexing is global, but the effect only feeds in the current channel's messages (current_channel_sigderived list); switching channels wipes the index for the previous channel.Impact / Threat
User-facing — every keystroke that arrives over the wire causes a UI stutter; cross-channel search is broken (results vanish when you switch away).
Suggested fix
Use the existing
incremental_insertpath onMessageReceivedevents; subscribe at the client-event stream level instead of the rendered-message signal. Hydrate once on bootstrap.Verify
rg "search\.rebuild\(indexable\)" crates/web/src/app.rs