- fix: typescript type import errors on development and compilation
- fix: bump version
@lemasc/firebase-wrapper
for commonjs support
- feat: use
@lemasc/firebase-wrapper
for compatibility on both web and React Native environments. Not final. See the ongoing discussion.
- feat: Add beta
FieldValue
andmergeFields
(dot-notation field updates) support for static mutations.
@lemasc/swr-firestore
no longer requiresFuego
class and wrapping root component withFuegoProvider
. It will use the[DEFAULT]
app instance automatically. Initialize it somewhere before trying to use in your hook.- Keys are now serialized by SWR, so Cache class logic has been changed. This should not affect your code. Submit an issue if mutation doesn't work.
useCollection
no longer constructs query constraints internally, you controls how the constrainsts are created and ordered. Pass constraints to theconstaints
parameter instead.
Before:
const { data } = useCollection('users', {
where: ['name', '==', 'fernando'],
limit: 10,
orderBy: ['age', 'desc'],
listen: true,
})
After:
import {
where,
limit,
orderBy
} from "@lemasc/swr-firestore/constraints"
// You can also import from '@firebase/firestore'
// but you will lose type check benefits.
const { data } = useCollection('users', {
// Notice below!
constraints: [
where('name', '==', 'fernando'),
orderBy('age', 'desc'),
limit(10),
],
listen: true,
})
- Refactor library to be more modular.
- Add document schema validator.
- Deduplicate code into
internals
folder. - Exports the internally used snapshot listener for advanced use cases.
- Serialize Firestore query using the internal
_query
property. This may subject to change in the future.
- Use the stable channel of firebase (v9.1.x)
- Update SWR to version 1.
- useDocument and useCollection won't return
revalidate()
due to SWR changes. - API functions renamed for similarity with the new firebase SDK.
set()
is nowsetDoc()
update()
is nowupdateDoc()
deleteDocument()
is nowdeleteDoc()
revalidateDocument()
is nowrevalidateDoc()
getDocument()
is nowgetDoc()
getCollection()
is nowgetDocs()
- Use
getFuego()
to get the current database instance instead of importingfuego
variable directly.