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

fix(datastore): configure function triggers initial sync unexpectedly #986

Merged
merged 1 commit into from
Jan 12, 2022

Conversation

HuiSF
Copy link
Member

@HuiSF HuiSF commented Oct 19, 2021

Issue #, if available: #736

Description of changes:

Originally below code is executed within DataStore.configure.

_channel.invokeMethod('setUpObserve', {})

This method channel call invokes observe() method of native DataStore plugins, which triggers API_SYNC. This behavior is undesired especially when data model authorization requires valid user session.

Moving the method call to each DataStore operation process, the actually logic of setUpObserve will only be invoked once.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@HuiSF HuiSF requested a review from a team as a code owner October 19, 2021 23:46
Copy link
Contributor

@fjnoyp fjnoyp left a comment

Choose a reason for hiding this comment

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

Looks good! Just need to wait for CircleCI to be unblocked again.

@codecov-commenter
Copy link

codecov-commenter commented Oct 22, 2021

Codecov Report

Merging #986 (22d861d) into main (3461561) will decrease coverage by 0.01%.
The diff coverage is 63.63%.

@@             Coverage Diff              @@
##               main     #986      +/-   ##
============================================
- Coverage     51.38%   51.37%   -0.02%     
  Complexity        1        1              
============================================
  Files           325      325              
  Lines         12312    12321       +9     
  Branches        460      461       +1     
============================================
+ Hits           6327     6330       +3     
- Misses         5821     5826       +5     
- Partials        164      165       +1     
Flag Coverage Δ
android-unit-tests 62.20% <0.00%> (-0.08%) ⬇️
flutter-unit-tests 37.30% <87.50%> (+<0.01%) ⬆️
ios-unit-tests 95.41% <ø> (ø)

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

Impacted Files Coverage Δ
...mplify/amplify_datastore/AmplifyDataStorePlugin.kt 66.94% <0.00%> (-0.57%) ⬇️
...mplify_datastore/lib/method_channel_datastore.dart 73.91% <87.50%> (+0.51%) ⬆️
...kages/amplify_datastore/lib/amplify_datastore.dart 68.29% <0.00%> (-4.88%) ⬇️

@dnys1 dnys1 marked this pull request as draft November 17, 2021 18:53
@HuiSF HuiSF marked this pull request as ready for review January 12, 2022 00:35
@HuiSF HuiSF merged commit edea986 into aws-amplify:main Jan 12, 2022
@HuiSF HuiSF deleted the fix/datastore-init-sync branch January 12, 2022 23:00
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.

4 participants