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

Unable to Edit Trip #4

Open
tiyberius opened this issue Nov 1, 2023 · 10 comments
Open

Unable to Edit Trip #4

tiyberius opened this issue Nov 1, 2023 · 10 comments
Assignees

Comments

@tiyberius
Copy link

I am following this tutorial https://aws.amazon.com/getting-started/hands-on/build-flutter-mobile-app-part-two/module-one/ and it is broken. I have followed the steps on two separate occasions now and I've gotten the same result. I don't know who is writing these tutorials, but it sure doesn't inspire confidence in the Amplify framework. Anyway, here's my environment:

$ amplify --version
12.7.1
$ flutter --version
Flutter 3.13.9 • channel stable • https://github.com/flutter/flutter.git
Framework • revision d211f42860 (7 days ago) • 2023-10-25 13:42:25 -0700
Engine • revision 0545f8705d
Tools • Dart 3.1.5 • DevTools 2.25.0
$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.13.9, on macOS 13.4.1 22F770820d darwin-arm64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.1)
[✓] VS Code (version 1.83.1)
[✓] Connected device (3 available)
[✓] Network resources

• No issues found!
  1. Clone the Flutter app as the tutorial suggests git clone https://github.com/aws-samples/amplify-trips-planner.git
  2. Change into the newly cloned repository. The command in the tutorial is wrong, btw. It says cd amplify_trips_planner but instead it should say amplify-trips-planner because that was the result of the git clone command.
  3. Add dependencies according to the tutorial
  4. flutter pub get
  5. amplify init
  6. amplify push
  7. Start the project in an emulator
  8. Add a Trip
  9. Navigate to the newly created trip
  10. Edit the trip by tapping the pencil Icon
  11. Update the trip name and tap "OK"
  12. The trip name was not updated
@tiyberius
Copy link
Author

A few additional things to note that might help with finding the cause of this issue:

After the trip name update fails as mentioned above, If I run

amplify codegen models

The command succeeds but then causes an error in the code. We get a

The method 'TripModelIdentifier' isn't defined for the type 'TripsAPIService'.
Try correcting the name to the name of an existing method, or defining a method named 'TripModelIdentifier'.dart[undefined_method](https://dart.dev/diagnostics/undefined_method)

at

I also noticed that in Part One of the tutorial, I don't believe that Datastore was enabled. However, in the cloned repository, it seems that datastore IS enabled:

"conflictResolution": {
"defaultResolutionStrategy": {
"type": "AUTOMERGE"
}
}

@offlineprogrammer offlineprogrammer self-assigned this Nov 1, 2023
@offlineprogrammer
Copy link
Contributor

@tiyberius Thanks for your feedback

I'll review and get back to you

Regards
Mo

@tiyberius
Copy link
Author

tiyberius commented Nov 1, 2023

I can also confirm that I've just worked through the entirety of Part One of the tutorial and the edit trip feature works. Additionally, I can confirm that Conflict Detection (and therefore Datastore) is NOT enabled when working through part one of the tutorial.

@tiyberius
Copy link
Author

I've figured out a workaround for this issue.

  1. Clone the repository mentioned in Step One of Module One of Part Two
  2. Apply the fix in the aforementioned Pull Request
  3. Run amplify init and amplify push
  4. The stack that gets created will NOT have Conflict Detection and won't create the Datastore tables in DynamoDB, which is what we want because it mimics the end result of Part One of the tutorial

However, I believe this is indicative of a larger issue. I was working through this tutorial in order to identify a separate issue around Conflict Detection (Datastore) and any models that have an "owner".

So, although I have identified a workaround for the tutorial, there is still a larger issue that remains unsolved: Why doesn't the tutorial work when Conflict Detection IS on?

@offlineprogrammer
Copy link
Contributor

@tiyberius Thanks for all the details you shared, very helpful

The Conflict Detection is required for DataStore, We recently updated the tutorial to use GraphQL API without datastore, so you don't need to turn it on

@tiyberius
Copy link
Author

Yes, I understand that Conflict Detection is required for DataStore and if you recently updated the tutorial to use the GraphQL API without DataStore, then my Pull Request should fix that.

However, do you know why the trip is unable to be edited (or deleted) when Conflict Detection is on? Shouldn't it work?

@offlineprogrammer
Copy link
Contributor

However, do you know why the trip is unable to be edited (or deleted) when Conflict Detection is on? Shouldn't it work?

I'll look into that

@tiyberius
Copy link
Author

Great, thank you. In a separate project, I am using DataStore for a mobile app that I'm trying to release and that is a critical issue holding me up from releasing the app on time.

@Souptik-Coder
Copy link

@tiyberius Hi, I am planning to use DataStore in one of my project. Is this conflict issue resolved yet or In which scenarios does it not work?

@tiyberius
Copy link
Author

Hello @Souptik-Coder, I am unsure if this issue is resolved or not. I decided not to use DataStore in my project as it was too slow to start up and too slow to sync. It was causing a bad user experience so I abandoned it in favor of using Flutter Riverpod and API calls.

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

No branches or pull requests

3 participants