Skip to content

Conversation

@yugalgaur174
Copy link

Fixes #7859

Summary

Removes the broken "handle" pattern from UploadTask Example 3 that was causing the error "undefined is not an object (evaluating 't.next')".

Changes

  • Removed the incorrect example code that attempted to use uploadTask.on('state_changed') as a subscribe function
  • The implementation always returns Unsubscribe when callbacks are passed, not a Subscribe function
  • Kept the working example that directly passes callbacks to on()

Testing

  • Verified the storage package builds successfully
  • This is a documentation-only change (JSDoc comment), no code changes

@yugalgaur174 yugalgaur174 requested review from a team, maneesht and tonyjhuang as code owners December 23, 2025 18:15
@changeset-bot
Copy link

changeset-bot bot commented Dec 23, 2025

⚠️ No Changeset found

Latest commit: bdc71c2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@google-cla
Copy link

google-cla bot commented Dec 23, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @yugalgaur174, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical documentation error within the storage package's UploadTask examples. It specifically targets and removes a misleading code snippet from Example 3 that demonstrated an incorrect 'handle' pattern for subscribing to state changes, which was causing runtime errors. The change ensures that the documentation accurately reflects the API's behavior, where the on() method directly returns an unsubscribe function when callbacks are provided, thereby improving clarity and preventing future developer confusion.

Highlights

  • Documentation Fix: Corrected an erroneous code example in the UploadTask documentation for the storage package.
  • Error Resolution: Removed a 'handle' pattern from Example 3 that was causing an 'undefined is not an object' error due to incorrect usage of uploadTask.on('state_changed').
  • API Clarity: Clarified that uploadTask.on() directly returns an Unsubscribe function when callbacks are passed, rather than a Subscribe function.
  • Scope of Change: This is a documentation-only change with no impact on the underlying code logic.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly removes a broken code example from the UploadTask.on() documentation. The change is accurate, as the implementation doesn't support the Subscribe function pattern shown in the removed example.

However, the fix is incomplete. I've identified two other examples in the same JSDoc block that are also broken for the same reason. To fully resolve the documentation issue and prevent developer confusion, I recommend removing them as well.

Affected Code Examples:

The following examples in packages/storage/src/public-types.ts are also inconsistent with the implementation:

  • Lines 307-309:

    * // This is equivalent to the first example.
    * var subscribe = uploadTask.on(firebase.storage.TaskEvent.STATE_CHANGED);
    * subscribe(next, error, complete);
  • Lines 311-317:

    * // This is equivalent to the first example.
    * var subscribe = uploadTask.on(firebase.storage.TaskEvent.STATE_CHANGED);
    * subscribe({
    *   'next': next,
    *   'error': error,
    *   'complete': complete
    * });

By removing these as well, the documentation for UploadTask.on() will be fully consistent with its behavior. Other than this suggestion, the current change is a good improvement.

@yugalgaur174 yugalgaur174 force-pushed the fix-uploadtask-example-3 branch from d66c2ba to bdc71c2 Compare December 23, 2025 18:21
@yugalgaur174
Copy link
Author

Hello! @maneesht and @tonyjhuang

I’ve fixed a broken UploadTask example that was leading to runtime errors (Fixes #7859).
Please review it whenever it’s convenient for you.

Thanks!
I’m happy to address any feedbacks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UploadTask Example 3 broken

1 participant