AndrewRqy commited on
Commit ·
7d8efb5
1
Parent(s): 58e2869
Remove gr.skip diff — broke multi-yield generator handlers, blocking grimoire->trial transition
Browse files3883 unmodified lines38843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113883 unmodified lines*_localized_chrome_updates(state),)# Diff against the last bundle sent for this session and replace# unchanged elements with gr.skip(). The state is mutable and the same# reference flows through every handler, so we cache the previous# bundle directly on it. Slots 0 (state) and 1 (trial_substate) are# always returned in full — gr.State components track their values# by identity, not diff.last = getattr(state, "_last_bundle", None)state._last_bundle = list(new_bundle)if last is None or len(last) != len(new_bundle):return new_bundlediffed = list(new_bundle[:2])for i in range(2, len(new_bundle)):new_val = new_bundle[i]old_val = last[i]try:if new_val == old_val:diffed.append(gr.skip())continueexcept Exception:passdiffed.append(new_val)return tuple(diffed)# ---------------------------------------------------------------------------3883 unmodified lines3884388538863887388838893890389138923893389438953896389738983883 unmodified lines*_localized_chrome_updates(state),)# NOTE: gr.skip() diff was tried here to reduce payload by sending# only changed outputs. It broke multi-yield generator handlers like# handle_grimoire_begin → handle_send_off (an internal _ui_bundle# call updated the cache to a state that was never sent to the# client, so the next yield diffed everything as "unchanged" and# the client never received the new page). The memoized HTML helpers# still provide most of the speedup; this path now just returns# the full bundle.return new_bundle# ---------------------------------------------------------------------------
app.py+9-22