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

bug: Firestore arrayUnion #458

Closed
5 of 14 tasks
jongbonga opened this issue Oct 15, 2023 · 1 comment
Closed
5 of 14 tasks

bug: Firestore arrayUnion #458

jongbonga opened this issue Oct 15, 2023 · 1 comment
Labels
bug/fix Something isn't working duplicate This issue or pull request already exists package: firestore

Comments

@jongbonga
Copy link

Plugin(s)

  • Analytics
  • App
  • App Check
  • Authentication
  • Crashlytics
  • Cloud Firestore
  • Cloud Messaging
  • Performance
  • Remote Config

Did you test the latest version?

  • I use the latest version

Platform(s)

  • Android
  • iOS
  • Web

Current behavior

When I use arrayUnion in setDocument on the web this is what I get
Screenshot 2023-10-15 at 05 25 52
The result is perfect and I tested extensively and I'm happy with the result.

But when used on iOS this is the result
Screenshot 2023-10-15 at 05 25 30

_methodName & wu are added and I'm not sure why...

My code is fairly simple, maybe because arrayUnion is imported from firebase/firestore

import { FirebaseFirestore } from '@capacitor-firebase/firestore';
import { arrayUnion, Timestamp } from 'firebase/firestore';

const messages = userId
  ? arrayUnion({
      id: nanoid(8),
      text,
      timestamp: Timestamp.now(),
      userId
    })
  : [];

await FirebaseFirestore.setDocument({
  reference: `trips/${tripId}/chats/${stopId}`,
  data: { messages },
  merge: true
});

Expected behavior

I'd would expect the web & native result to match

Reproduction

n/a

Steps to reproduce

import { FirebaseFirestore } from '@capacitor-firebase/firestore';
import { arrayUnion, Timestamp } from 'firebase/firestore';

const messages = userId
  ? arrayUnion({
      id: nanoid(8),
      text: 'test',
      timestamp: Timestamp.now(),
      userId
    })
  : [];

await FirebaseFirestore.setDocument({
  reference: `trips/${tripId}/chats/${stopId}`,
  data: { messages },
  merge: true
});

Other information

No response

Capacitor doctor

❯ npx capacitor doctor
💊   Capacitor Doctor  💊 

Latest Dependencies:

  @capacitor/cli: 5.5.0
  @capacitor/core: 5.5.0
  @capacitor/android: 5.5.0
  @capacitor/ios: 5.5.0

Installed Dependencies:

  @capacitor/cli: 5.5.0
  @capacitor/android: 5.5.0
  @capacitor/ios: 5.5.0
  @capacitor/core: 5.5.0

[success] iOS looking great! 👌
[success] Android looking great! 👌

Before submitting

  • I understand that incomplete issues (e.g. without reproduction) are closed.
@jongbonga jongbonga added bug/fix Something isn't working needs: triage labels Oct 15, 2023
@robingenz
Copy link
Member

Thank you for your request.
arrayUnion is not yet supported.
I close this issue as duplicate of #443.

@robingenz robingenz added package: firestore duplicate This issue or pull request already exists and removed needs: triage labels Oct 15, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug/fix Something isn't working duplicate This issue or pull request already exists package: firestore
Projects
None yet
Development

No branches or pull requests

2 participants