perf(ui): reuse hint result as move preview, skip redundant evaluate
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Has been skipped
CI / integration (pull_request) Has been skipped
CI / ui (pull_request) Successful in 53s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m9s
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Has been skipped
CI / integration (pull_request) Has been skipped
CI / ui (pull_request) Successful in 53s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m9s
Taking a hint auto-placed the suggested tiles and then called recompute(), which round-trips a debounced evaluate for that exact placement. The hint is the engine's own top-ranked, fully scored legal move, so its move already carries the score, words and direction an evaluate would return — the second call was pure duplicate work and added a visible disabled->enabled flicker on the submit button over slow links. Seed the move preview directly from the hint move via previewFromHint and cancel any pending evaluate timer so a stale one cannot clobber it. A later manual edit re-arms recompute() as before, so rearranged tiles are re-evaluated normally. Client-only; no backend, wire or schema change.
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
newPlacement,
|
||||
place,
|
||||
placementFromHint,
|
||||
previewFromHint,
|
||||
rackView,
|
||||
recallAt,
|
||||
recallToSlot,
|
||||
@@ -751,7 +752,14 @@
|
||||
if (isCoarse()) zoomed = true;
|
||||
view = { ...view, hintsRemaining: h.hintsRemaining, walletBalance: h.walletBalance };
|
||||
syncWallet(h.walletBalance);
|
||||
recompute();
|
||||
// The hint is the engine's own top-ranked, fully scored legal move: reuse it as the
|
||||
// preview instead of a redundant evaluate (same engine call, same placement). Cancel any
|
||||
// pending evaluate so a stale one cannot clobber it; a later manual edit re-arms recompute().
|
||||
if (previewTimer) {
|
||||
clearTimeout(previewTimer);
|
||||
previewTimer = null;
|
||||
}
|
||||
preview = previewFromHint(h.move);
|
||||
}
|
||||
} catch (e) {
|
||||
// The backend does not spend a hint when there is no move.
|
||||
|
||||
Reference in New Issue
Block a user