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

TemporalDateTime wrong on each device #4492

Closed
4 of 14 tasks
harrynguyen2510 opened this issue Feb 28, 2024 · 5 comments
Closed
4 of 14 tasks

TemporalDateTime wrong on each device #4492

harrynguyen2510 opened this issue Feb 28, 2024 · 5 comments
Labels
datastore Issues related to the DataStore Category pending-close-response-required The issue will be closed if details necessary to reproduce the issue are not provided within 7 days.

Comments

@harrynguyen2510
Copy link

harrynguyen2510 commented Feb 28, 2024

Description

I'm building a chat app and having issues about timing of message

Here is the function to create message

    DateTime now = DateTime.now();
    String dateUpload = convertDateString(now.toUtc());
    String timeUpload = convertFullTimeString(now.toUtc());

    TemporalDateTime temporalNowUTC = TemporalDateTime.now();

    MessageItem newMessage = MessageItem(
      contenttype: contenttype,
      content: content,
      replyFromMessageid: replyonmessageid,
      sentbyUserID: currentUser.id,
      onChatroomID: chatroom.id,
      isforward: isForward,
      withPollID: withPollID,
      createdDate: dateUpload,
      createdTime: timeUpload,
      createdAt: temporalNowUTC,
      updatedAt: temporalNowUTC,
    );

    String newMessageid = newMessage.id;

    await Amplify.DataStore.save(newMessage);

As you can see I get TemporalDateTime.now() to take UTC date time on current device then upload to Amplify Datastore,
When I open Datastore content board, sort list of messages in latest-oldest order to observe the timing of message uploading
I found message of phone A, time upload is right, because new message adding to the board is on top, but not for B, message from B is added somewhere below (even B sent message after A)
A Quick notice that, messages from A is formed together in order on board, while B has formed as well, but this doesn't alway happen
This issue results in like this:
For example, from

  • On chat: Message A, A, A, B, B, A,B (right order, because list.add(...)
  • Reload from Cloud: B,B,B, A, A,A

Categories

  • Analytics
  • API (REST)
  • API (GraphQL)
  • Auth
  • Authenticator
  • DataStore
  • Notifications (Push)
  • Storage

Steps to Reproduce

No response

Screenshots

Screenshot 2024-02-29 at 09 51 50

Platforms

  • iOS
  • Android
  • Web
  • macOS
  • Windows
  • Linux

Flutter Version

3.19.1

Amplify Flutter Version

12.10.1

Deployment Method

Amplify CLI

Schema

type MessageItem @model @auth(rules: [{allow: public}]) {
  id: ID!
  content: String
  filekey: [String]
  hasFile: Boolean
  contenttype: String!
  replyFromMessageid: String
  sentbyUserID: String!
  onChatroomID: String!
  isforward: Boolean
  isDeleted: Boolean
  withPollID: String
  createdTime: String
  createdDate: String
  createdAt: AWSDateTime
  updatedAt: AWSDateTime
}
@Equartey Equartey added datastore Issues related to the DataStore Category pending-triage This issue is in the backlog of issues to triage labels Feb 28, 2024
@Equartey
Copy link
Contributor

Hi @harrynguyen2510,

I understand you're seeing inconsistent ordering of messages in your app.

It's unclear to me how you are sorting them. What value you are sorting by? By what method?

Also what do you mean by Datastore content board?

@harrynguyen2510
Copy link
Author

harrynguyen2510 commented Feb 28, 2024

Hi @Equartey thanks for reply, I have updated the Datastore content board image above, please take a look at it. It's high chance that the root of issue is from TemporalDateTime when creating message

@Equartey Equartey added to-be-reproduced Issues that have not been reproduced yet, but have reproduction steps provided Investigating and removed pending-triage This issue is in the backlog of issues to triage labels Feb 29, 2024
@harrynguyen2510
Copy link
Author

any update?

@Jordan-Nelson
Copy link
Contributor

Jordan-Nelson commented Mar 7, 2024

@harrynguyen2510 can you fill out the reproduction steps section in the issue template? Thanks

@Jordan-Nelson Jordan-Nelson added pending-response Issue is pending response from the issue requestor and removed to-be-reproduced Issues that have not been reproduced yet, but have reproduction steps provided labels Mar 7, 2024
@Jordan-Nelson
Copy link
Contributor

@harrynguyen2510 if you are still facing this issue please fill out the reproduction steps in the issue template. Thanks.

@Jordan-Nelson Jordan-Nelson added pending-close-response-required The issue will be closed if details necessary to reproduce the issue are not provided within 7 days. and removed pending-response Issue is pending response from the issue requestor labels Mar 26, 2024
@Jordan-Nelson Jordan-Nelson closed this as not planned Won't fix, can't repro, duplicate, stale Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datastore Issues related to the DataStore Category pending-close-response-required The issue will be closed if details necessary to reproduce the issue are not provided within 7 days.
Projects
None yet
Development

No branches or pull requests

3 participants