Skip to content
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

Merged
merged 60 commits into from
Oct 9, 2020

Conversation

CrisTofani
Copy link
Contributor

This PR depends on #2255

Short description

This PR connects the SearchBankScreen with store and load remote data for abis list.

@pagopa-github-bot pagopa-github-bot changed the title [#175142335] Connects Search Bank screen with store and remote data feat(Bonus Pagamenti Digitali): [#175142335] Connects Search Bank screen with store and remote data Oct 6, 2020
@pagopa-github-bot
Copy link
Collaborator

pagopa-github-bot commented Oct 6, 2020

Affected stories

  • 🌟 #175142335: Collegare la schermata di selezione istituto bancario con networking / store

Generated by 🚫 dangerJS against 90cb16a

@CrisTofani CrisTofani requested a review from Undermaken October 8, 2020 13:48
locales/en/index.yml Outdated Show resolved Hide resolved
@@ -31,6 +31,8 @@ export function* handleLoadAbi(
}
} catch (e) {
yield put(loadAbi.failure(e));
yield delay(200);
Copy link
Contributor

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?

Copy link
Contributor Author

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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const keyExtractor = (bank: any): string => bank.abi;
const keyExtractor = (bank: Abi): string => bank.abi;

);
const [isSearchStarted, setIsSearchStarted] = React.useState(false);

const performSearch = (text: string) => {
Copy link
Contributor

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.

Suggested change
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-commenter
Copy link

Codecov Report

Merging #2266 into master will decrease coverage by 0.00%.
The diff coverage is 50.00%.

Impacted file tree graph

@@            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              
Impacted Files Coverage Δ
...allet/onboarding/bancomat/saga/networking/index.ts 37.50% <33.33%> (-5.36%) ⬇️
...s/wallet/onboarding/bancomat/store/reducers/abi.ts 46.42% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f96be24...0c53610. Read the comment docs.

@codecov-io
Copy link

codecov-io commented Oct 9, 2020

Codecov Report

Merging #2266 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           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            
Impacted Files Coverage Δ
ts/features/wallet/onboarding/store/abi.ts 46.42% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bed6ab5...90cb16a. Read the comment docs.

@CrisTofani CrisTofani requested a review from Undermaken October 9, 2020 15:42
@Undermaken Undermaken merged commit cad3dde into master Oct 9, 2020
@CrisTofani CrisTofani deleted the 175142335-connect-search-bank-screen-redux branch March 23, 2021 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants