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: [IOPLT-724] Split up the backend status for better handling #6296

Open
wants to merge 20 commits into
base: master
Choose a base branch
from

Conversation

CrisTofani
Copy link
Contributor

@CrisTofani CrisTofani commented Oct 17, 2024

Short description

This PR aims to split the backendStatus reducer and store section into 4 different reducers

List of changes proposed in this pull request

  • Removed backendStatus reducer
  • Created remoteConfig, sectionStatus, backendInfo, statusMessages reducers

How to test

Anything should work properly as usual after changes.

@pagopa-github-bot pagopa-github-bot changed the title [IOPLT-724] Split up the backend status for better handling feat: [IOPLT-724] Split up the backend status for better handling Oct 17, 2024
@pagopa-github-bot
Copy link
Collaborator

pagopa-github-bot commented Oct 17, 2024

Affected stories

  • 🌟 IOPLT-724: Come DEV voglio suddividere la gestione delle configurazioni remote sull'APP per ottimizzarne le evoluzioni future

Generated by 🚫 dangerJS against e03e098

Copy link

codecov bot commented Oct 17, 2024

Codecov Report

Attention: Patch coverage is 58.06452% with 78 lines in your changes missing coverage. Please review.

Project coverage is 47.00%. Comparing base (4f204b4) to head (e03e098).
Report is 660 commits behind head on master.

Files with missing lines Patch % Lines
ts/store/reducers/backendStatus/remoteConfig.ts 46.61% 61 Missing and 2 partials ⚠️
ts/store/reducers/backendStatus/backendInfo.ts 68.75% 5 Missing ⚠️
ts/store/reducers/backendStatus/statusMessages.ts 68.75% 5 Missing ⚠️
ts/screens/modal/SystemOffModal.tsx 0.00% 2 Missing ⚠️
ts/store/reducers/backendStatus/sectionStatus.ts 93.10% 2 Missing ⚠️
ts/components/wallet/PaymentMethodsList.tsx 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6296      +/-   ##
==========================================
- Coverage   48.42%   47.00%   -1.43%     
==========================================
  Files        1488     1818     +330     
  Lines       31617    36898    +5281     
  Branches     7669     8827    +1158     
==========================================
+ Hits        15311    17343    +2032     
- Misses      16238    19490    +3252     
+ Partials       68       65       -3     
Files with missing lines Coverage Δ
ts/components/SectionStatus/index.tsx 100.00% <ø> (+2.77%) ⬆️
ts/components/SectionStatus/modal/index.tsx 61.70% <ø> (ø)
ts/components/screens/BaseHeader.tsx 78.37% <ø> (-5.63%) ⬇️
...s/components/screens/BaseScreenComponent/index.tsx 62.96% <ø> (-11.12%) ⬇️
...code/components/BarcodeScanBaseScreenComponent.tsx 77.77% <ø> (-1.59%) ⬇️
ts/features/barcode/screens/BarcodeScanScreen.tsx 1.38% <ø> (-0.07%) ⬇️
ts/features/bonus/cgn/screens/CgnDetailScreen.tsx 4.54% <ø> (-9.41%) ⬇️
...screens/activation/CgnCTAStartActivationScreen.tsx 16.00% <ø> (-6.73%) ⬇️
...ures/bonus/common/screens/AvailableBonusScreen.tsx 7.69% <ø> (-1.24%) ⬇️
ts/features/cieLogin/store/selectors/index.ts 66.66% <ø> (+16.66%) ⬆️
... and 87 more

... and 1355 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

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

return state;
};

export const backendInfoSelector = (state: GlobalState) => state.backendInfo;
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this selector is "a thing of the past" and it is used only in ts/sagas/backendStatus.ts, should we remove it and refactor the latter to use isBackendServicesStatusOffSelector and a new deadsCounterSelector?

ts/features/fims/history/store/selectors/index.ts Outdated Show resolved Hide resolved
ts/features/pn/utils/index.ts Outdated Show resolved Hide resolved
ts/features/tos/store/selectors/index.ts Outdated Show resolved Hide resolved
@@ -49,8 +49,9 @@ export function* backendStatusWatcherLoop(
backendStatusSaga,
getStatus
);
const currentState: ReturnType<typeof backendServicesStatusSelector> =
yield* select(backendServicesStatusSelector);
const currentState: ReturnType<typeof backendInfoSelector> = yield* select(
Copy link
Contributor

Choose a reason for hiding this comment

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

See comment on the reducer's file about removing this one in favour of two distinct selectors

@@ -241,7 +241,7 @@ export function* initializeApplicationSaga(
// Since the backend.json is done in parallel with the startup saga,
// we need to synchronize the two tasks, to be sure to have loaded the remote FF
// before using them.
const backendStatus = yield* select(backendStatusSelector);
const backendStatus = yield* select(remoteConfigSelector);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we rename backendStatus to remoteConfig ?

import { getFullLocale } from "../../utils/locale";
const SystemOffModal = () => {
const backendStatus = useSelector(backendStatusSelector, _.isEqual);
const backendInfoMessage = useSelector(backendInfoMessageSelector);
Copy link
Contributor

Choose a reason for hiding this comment

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

Removing the _.isEqual comparison function may change the desired behaviour. Are we sure about this?

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.

3 participants