Skip to content

Conversation

@bangjiehan
Copy link

Standard only state that auto-commit happen after requests finished and results handled.
Results handle by related events so implementation might wait for event queue to be empty.

When a transaction has been started and it can no longer become active, the implementation must attempt to commit it, as long as the transaction has not been aborted. This usually happens after all requests placed against the transaction have been executed and their returned results handled, and no new requests have been placed against the transaction.

from indexeddb api 2.0

@javascript-translate-bot javascript-translate-bot added the review needed Review needed, please approve or request changes label Mar 13, 2025
@javascript-translate-bot javascript-translate-bot requested review from a team March 13, 2025 03:27
@bangjiehan bangjiehan marked this pull request as ready for review March 13, 2025 08:04
@smith558 smith558 self-assigned this Apr 13, 2025
@smith558 smith558 added the P1 High priority label Apr 13, 2025
@smith558 smith558 requested a review from Copilot September 26, 2025 11:17
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR corrects terminology inconsistencies in the IndexedDB documentation regarding microtasks vs macrotasks and their relationship to transaction auto-commit behavior.

  • Corrects the description of when IndexedDB transactions auto-commit (macrotasks queue instead of microtasks queue)
  • Fixes the classification of fetch as a microtask instead of macrotask
  • Updates the explanation of transaction timing behavior to use consistent terminology

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

```

That's because `fetch` is an asynchronous operation, a macrotask. Transactions are closed before the browser starts doing macrotasks.
That's because `fetch` is an asynchronous operation, a microtask. Transactions are closed before the browser starts doing microtasks.
Copy link

Copilot AI Sep 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is incorrect. fetch is a macrotask, not a microtask. The original text was correct - fetch creates a macrotask and transactions are closed before macrotasks execute.

Suggested change
That's because `fetch` is an asynchronous operation, a microtask. Transactions are closed before the browser starts doing microtasks.
That's because `fetch` is an asynchronous operation, a macrotask. Transactions are closed before the browser starts doing macrotasks.

Copilot uses AI. Check for mistakes.
### "Inactive transaction" pitfall

As we already know, a transaction auto-commits as soon as the browser is done with the current code and microtasks. So if we put a *macrotask* like `fetch` in the middle of a transaction, then the transaction won't wait for it to finish. It just auto-commits. So the next request in it would fail.
As we already know, a transaction auto-commits as soon as the browser is done with the current code and macrotasks. So if we put a *microtask* like `fetch` in the middle of a transaction, then the transaction won't wait for it to finish. It just auto-commits. So the next request in it would fail.
Copy link

Copilot AI Sep 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change introduces an error. fetch is a macrotask, not a microtask. The sentence should read 'So if we put a macrotask like fetch' to be technically accurate.

Suggested change
As we already know, a transaction auto-commits as soon as the browser is done with the current code and macrotasks. So if we put a *microtask* like `fetch` in the middle of a transaction, then the transaction won't wait for it to finish. It just auto-commits. So the next request in it would fail.
As we already know, a transaction auto-commits as soon as the browser is done with the current code and macrotasks. So if we put a *macrotask* like `fetch` in the middle of a transaction, then the transaction won't wait for it to finish. It just auto-commits. So the next request in it would fail.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P1 High priority review needed Review needed, please approve or request changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants