MCPcopy Create free account
hub / github.com/alephdata/aleph / getDerivedStateFromProps

Method getDerivedStateFromProps

ui/src/components/common/SearchBox.jsx:24–35  ·  view source on GitHub ↗
(nextProps, prevState)

Source from the content-addressed store, hash-verified

22 }
23
24 static getDerivedStateFromProps(nextProps, prevState) {
25 const nextQueryText = nextProps.query
26 ? nextProps.query.getString('q')
27 : prevState.queryText;
28 const queryChanged =
29 !prevState?.prevQuery ||
30 prevState.prevQuery.getString('q') !== nextQueryText;
31 return {
32 prevQuery: nextProps.query,
33 queryText: queryChanged ? nextQueryText : prevState.queryText,
34 };
35 }
36
37 onQueryTextChange(e) {
38 const queryText = e.target.value;

Callers

nothing calls this directly

Calls 1

getStringMethod · 0.80

Tested by

no test coverage detected