wallet icon indicating copy to clipboard operation
wallet copied to clipboard

fix(points): ensure sagas are spawned on statsig refresh

Open kathaypacific opened this issue 1 year ago • 6 comments

Description

Context.

Test plan

n/a

Related issues

n/a

Backwards compatibility

n/a

Network scalability

If a new NetworkId and/or Network are added in the future, the changes in this PR will:

  • [x] Continue to work without code changes, OR trigger a compilation error (guaranteeing we find it when a new network is added)

kathaypacific avatar Jul 05 '24 10:07 kathaypacific

Codecov Report

Attention: Patch coverage is 73.91304% with 12 lines in your changes missing coverage. Please review.

Project coverage is 86.48%. Comparing base (e5e2b3f) to head (1b8c56c). Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5617      +/-   ##
==========================================
- Coverage   86.49%   86.48%   -0.01%     
==========================================
  Files         772      774       +2     
  Lines       31671    31702      +31     
  Branches     5466     5177     -289     
==========================================
+ Hits        27394    27419      +25     
- Misses       4043     4238     +195     
+ Partials      234       45     -189     
Files Coverage Δ
src/points/PointsDiscoverCard.tsx 100.00% <100.00%> (ø)
src/points/saga.ts 85.16% <70.00%> (-2.52%) :arrow_down:

... and 90 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 e5e2b3f...1b8c56c. Read the comment docs.

codecov[bot] avatar Jul 05 '24 10:07 codecov[bot]

should this fix the issue Jean complained about?

bakoushin avatar Jul 05 '24 13:07 bakoushin

should this fix the issue Jean complained about?

yes i think so!

kathaypacific avatar Jul 05 '24 14:07 kathaypacific

now the sagas are spawned no matter what the statsig value is, but despite we are waiting until the address exists it is not enough time and we have to wait (or listen) to when the statsig will finish its update

bakoushin avatar Jul 05 '24 14:07 bakoushin

I've put some console.logs:

[13:51:04.623Z] [90miPhone 15[39m --- WAITING FOR ADDRESS TO EXIST
[13:51:25.493Z] [90miPhone 15[39m --- ADDRESS EXISTS
[13:51:25.495Z] [90miPhone 15[39m --- GETTING POINTS CONFIG {"showPoints": false}

notice it tries to get statsig config immediately after it gets an address. i guess it is too early. we have to wait for statsig to react to address update. i wonder if we have any way to handle it.

bakoushin avatar Jul 05 '24 14:07 bakoushin

or maybe we should watch some event other than APP_INIT to spawn initial sagas getting config and balance

bakoushin avatar Jul 05 '24 14:07 bakoushin

TY for the ideas @bakoushin ! i clearly didn't test properly before 😅 i also was thinking about triggering the sagas on a different event because the coordination of statsig and account initialisation was feeling too hard....

kathaypacific avatar Jul 08 '24 15:07 kathaypacific