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

fix(storage): expose static types for modular API #8322

Merged
merged 6 commits into from
Feb 13, 2025
Merged

Conversation

russellwheatley
Copy link
Member

Description

Related issues

Release Summary

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
    • Yes
  • My change supports the following platforms;
    • Android
    • iOS
  • My change includes tests;
    • e2e tests added or updated in packages/\*\*/e2e
    • jest tests added or updated in packages/\*\*/__tests__
  • I have updated TypeScript types that are affected by my change.
  • This is a breaking change;
    • Yes
    • No

Test Plan


Think react-native-firebase is great? Please consider supporting the project with any of the below:

Copy link

vercel bot commented Feb 11, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-native-firebase ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 13, 2025 8:45am

Comment on lines 31 to 32
// import { STATICS } from '@react-native-firebase/storage';
export const statics = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I did a little fixup here to make this work (by adding the export here and removing the export below)
but the other two statics PRs would not have the export here, they would leave it in modular only

Copy link
Member Author

Choose a reason for hiding this comment

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

good catch 👍 . I've also updated tests for static properties which I've done for others as well (using intellisense to pick up type properties as POC 😄 )

Copy link
Member Author

Choose a reason for hiding this comment

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

actually, I think we should remove the static export from here, it should be from modular only in my view

Copy link
Collaborator

Choose a reason for hiding this comment

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

So my fixup here quieted one error but I wasn't sure on it - and I like your way of thinking better

Action - the export here should be removed, and statics should just go into the registry function for namespace attachment

@mikehardy
Copy link
Collaborator

Huh - that appears to have caused a real issue:

         firebase v8 compatibility
           "before all" hook in "firebase v8 compatibility":
     TypeError: Cannot read property 'StringFormat' of undefined
      at putString (/home/runner/work/react-native-firebase/react-native-firebase/packages/storage/lib/StorageReference.js:201:43)
      at seed (/home/runner/work/react-native-firebase/react-native-firebase/packages/storage/e2e/helpers.js:14:59)
      at asyncGeneratorStep (/home/runner/work/react-native-firebase/react-native-

enhancement thought - but not on this PR - need to get those e2e tests in to typescript and have the type check as part of our lint checks which are fast enough to run locally and faster in CI

@mikehardy
Copy link
Collaborator

@russellwheatley I pushed a maybe-final commit here that adjusts this types PR to follow your thinking on the other two

  • no export of statics directly from namespaced
  • yes to your export of specific items from statics-file in modular

...and I adjusted the use of statics internally so they handle the new export style from the statics-file so it should pass e2e now

what do you think?

@russellwheatley
Copy link
Member Author

@mikehardy - yes, we're in agreement 🙏. Should hopefully go green now, there was one remaining pesky default export in that StorageReference file.

Copy link
Collaborator

@mikehardy mikehardy left a comment

Choose a reason for hiding this comment

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

A thing of beauty

@mikehardy mikehardy merged commit d4e532a into main Feb 13, 2025
18 of 19 checks passed
@mikehardy mikehardy deleted the fix-storage-types branch February 13, 2025 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants