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

hacky untyped fix for the duplicate answers problem #165

Merged
merged 3 commits into from
Mar 15, 2021

Conversation

scytacki
Copy link
Member

@scytacki scytacki commented Mar 15, 2021

This has no tests and isn't typed, but it might be worth merging since it seems to fix a critical bug when demoing this stuff.
I'll leave it up to you to decide.

I think I problem is described pretty well in the story:
https://www.pivotaltracker.com/story/show/177333639

The technical issue is that the host code using the the storage system is assuming that the watchAnswer callback will be called after the createOrUpdateAnswer is complete.

The issue is that the AP code using the storage facade, doesn't update its own answer objects.
It is counting on the storage facade to call its answerWatcher callback and then it updates the
answer object.
So the dexie provider needs to implement the answerWatcher better. The implementation here
does does this watching within the current tab. It isn't using dexie observable or something
similar to watch for changes across tabs.

Also this code isn't supporting the unsubscribing of the watchers. It doesn't look like the AP code
is calling this unsubscribe, in the normal case, but it should be.
@dougmartin
Copy link
Member

I think @knowuh should do the review on this.

Copy link
Contributor

@knowuh knowuh left a comment

Choose a reason for hiding this comment

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

Thanks @scytacki this looks good.

@codecov
Copy link

codecov bot commented Mar 15, 2021

Codecov Report

Merging #165 (4a387e0) into offline-mode (c770d2b) will decrease coverage by 0.42%.
The diff coverage is 0.00%.

Impacted file tree graph

@@               Coverage Diff                @@
##           offline-mode     #165      +/-   ##
================================================
- Coverage         75.74%   75.31%   -0.43%     
================================================
  Files                91       91              
  Lines              3187     3205      +18     
  Branches            717      721       +4     
================================================
  Hits               2414     2414              
- Misses              766      784      +18     
  Partials              7        7              
Flag Coverage Δ
cypress 65.64% <0.00%> (-0.38%) ⬇️
jest 61.19% <0.00%> (-0.35%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/storage/storage-facade.ts 31.88% <0.00%> (-3.04%) ⬇️

One more typing fix
@knowuh knowuh merged commit 1283fe4 into offline-mode Mar 15, 2021
@knowuh knowuh deleted the 177333639-fix-duplicate-answers branch March 15, 2021 19:45
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