-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(Bonus Pagamenti Digitali): [#175142335] Connects Search Bank screen with store and remote data #2266
feat(Bonus Pagamenti Digitali): [#175142335] Connects Search Bank screen with store and remote data #2266
Conversation
Affected stories
|
…-search-bank-screen-redux
@@ -31,6 +31,8 @@ export function* handleLoadAbi( | |||
} | |||
} catch (e) { | |||
yield put(loadAbi.failure(e)); | |||
yield delay(200); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a code for tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I preferred to keep a minimum delay before making the API request restart in order to avoid an excessive call to the PM API, what do you think?
setSearchText(text); | ||
}; | ||
|
||
const keyExtractor = (bank: any): string => bank.abi; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const keyExtractor = (bank: any): string => bank.abi; | |
const keyExtractor = (bank: Abi): string => bank.abi; |
); | ||
const [isSearchStarted, setIsSearchStarted] = React.useState(false); | ||
|
||
const performSearch = (text: string) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems it isn't working.
This is because performSearch
is used within React.useRef
so its scope never changes.
In particular props.bankList
has the first value (an empty array) when the component mounts so the search produces always an empty result.
const performSearch = (text: string) => { | |
const performSearch = (text: string, bankList: ReadonlyArray<Abi>) => { |
then add props.bankList
in useEffect
debounceRef.current(searchText,props.bankList);
Co-authored-by: Matteo Boschi <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #2266 +/- ##
==========================================
- Coverage 47.92% 47.91% -0.01%
==========================================
Files 543 543
Lines 15788 15790 +2
Branches 3159 3159
==========================================
Hits 7566 7566
- Misses 8180 8182 +2
Partials 42 42
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #2266 +/- ##
========================================
Coverage 47.92% 47.92%
========================================
Files 553 553
Lines 15986 15986
Branches 2930 3195 +265
========================================
Hits 7662 7662
Misses 8282 8282
Partials 42 42
Continue to review full report at Codecov.
|
This PR depends on #2255
Short description
This PR connects the SearchBankScreen with store and load remote data for abis list.