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

wait: true could wait for nested references in documents #1386

Open
posva opened this issue Jul 12, 2023 — with Volta.net · 2 comments
Open

wait: true could wait for nested references in documents #1386

posva opened this issue Jul 12, 2023 — with Volta.net · 2 comments
Labels

Comments

Copy link
Member

posva commented Jul 12, 2023

Currently it only affects Lists and Collections but it could be useful for documents as well because when hydrating we get a flash while the new references are being retrieved

@posva posva added the bug label Jul 12, 2023 — with Volta.net
@posva posva added feature request firestore new Cloud Store and removed bug labels Jul 27, 2023 — with Volta.net
@posva posva changed the title wait: true doesn't wait for nested refs before replacing wait: true could wait for nested references in documents Jul 27, 2023
@liweicheng00
Copy link

Is there any way to ensure that all referenced documents are fully loaded?

In my tests, if a document attribute is a reference to another document, like this:

For Task:

{
  "setting": "/setting/<settingId>"
}

For Setting:

{
  "type": "taskType",
  "number": 123
}

When using useDocument():

const task = useDocument(doc(collection(db, 'tournament'), "taskId"))
<template>
  <div v-if="task">
    <div> {{task.setting}} </div>   <!-- raises error -->
    <div> {{task?.setting}} </div>  <!-- this works, but it's inconvenient -->
  </div>
</template>

I believe this is an issue because I have to check whether the attribute exists at every usage point, as shown above. If I don't handle it properly (task?.setting), I encounter errors. This makes it difficult to pass the data to child components effectively.

@mrleblanc101
Copy link

mrleblanc101 commented Nov 11, 2024

@liweicheng00 I don't think there is. That's why there is the feature request tag.
Linking my Discussion topic with posva about this here: #1442

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants