To cancel a Firebase transaction, return nothing or undefined.
Example:
javascriptrunTransaction(ref(db, '/whatever'), value => value ? undefined : 'New')
You are rejecting the Promise by returning undefined, thus the transaction will be cancelled.
Hi, I'm Erik, an engineer from Barcelona. If you like the post or have any comments, say hi.