Skip to content

Code hangs on await updateDoc and await deleteDoc operations after calling disableNetwork #8657

@Daquisu

Description

@Daquisu

Operating System

Windows 11

Environment (if applicable)

Chrome 131.0.6778.86 (Official Build) (64-bit)

Firebase SDK Version

11.0.2

Firebase SDK Product(s)

Firestore

Project Tooling

Svelte with vite

Detailed Problem Description

Trying to achieve: I was trying to use await on write operations such as updateDoc and deleteDoc with the network disabled.

What actually happened: the code hung on the write operation, never finishing it.

Any error messages or unexpected behavior you observed: no error messages no warnings, it just hung there.

Relevant log snippets or console output (if available).: no relevant log message.

Steps and code to reproduce issue

Minimal steps to reproduce it:

async function demonstrateBug() {
  try {
    await disableNetwork(db);
    console.log('##### Network disabled');

    // This will hang indefinitely
    console.log('##### Attempting update...');
    await updateDoc(doc(db, 'collection', 'document'), {
      field: 'value'
    });

    // This line will never be reached
    console.log('##### Update complete');
  } catch (error) {
    console.error('##### Error:', error);
  }
}

Using only updateDoc instead of await updateDoc makes the code log ##### Update complete and the operation is properly completed on the local cache.

getDoc works fine even with the await.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions