don't re-compute values on first render (unnecessary, values are part of state)
This commit is contained in:
parent
174bab79e4
commit
2d0deca127
14 changed files with 274 additions and 115 deletions
|
|
@ -6,7 +6,7 @@ import { useContext, useEffect, useMemo, useRef, useState } from "react";
|
|||
import { Type } from "./Type";
|
||||
|
||||
import "./InputBlock.css";
|
||||
import type { Dynamic, State2Props } from "./util/extra";
|
||||
import type { Dynamic, State2Props } from "./types";
|
||||
import { EnvContext } from "./EnvContext";
|
||||
|
||||
export interface InputBlockState {
|
||||
|
|
@ -30,7 +30,7 @@ const computeSuggestions = (text, env, filter) => {
|
|||
... (asInt ? [[asInt.toString(), newDynamic(BigInt(asInt))(Int)]] : []),
|
||||
... trie.suggest(env.name2dyn)(text)(Infinity),
|
||||
]
|
||||
return ls;
|
||||
// return ls;
|
||||
return [
|
||||
...ls.filter(filter), // ones that match filter come first
|
||||
...ls.filter(s => !filter(s)),
|
||||
|
|
@ -158,7 +158,7 @@ export function InputBlock({ state, setState, filter, onCancel }: InputBlockProp
|
|||
spellCheck={false}/>
|
||||
{/* Single 'grey' suggestion */}
|
||||
<span className="text-block suggest">{singleSuggestion}</span>
|
||||
{ resolved && <>☑</>}
|
||||
{/* { resolved && <>☑</>} */}
|
||||
</span>
|
||||
</span>;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue