Bot releases are hidden (Show)
Published by marshallswain 5 months ago
Full Changelog: https://github.com/marshallswain/feathers-pinia/compare/v4.5.3...v4.5.4
Full Changelog: https://github.com/marshallswain/feathers-pinia/compare/v4.2.6...v4.4.1
Published by marshallswain 7 months ago
It's possible that the nested dynamic computed is breaking reactivity. The nested computed has been replaced with a direct reference to the stored value in itemsById
.
Published by marshallswain 7 months ago
Some reactivity in Pinia breaks when you use reactive instead of ref. This update switched the byId
object to use a ref
to fix reactivity.
Published by marshallswain 8 months ago
The new useBackup utility is the opposite of working with clones. Instead of binding your form to a clone, you use
the original record. It keeps a copy, letting you call backup
or restore
to revert changes. The save
method
auto-diffs from the backup, keeping data size to a minimum.
New methods have been added to the FeathersPinia Client. These utilities can be used inside setupInstance
functions to
help form relationships between services:
storeAssociated
.storeAssociated
DeprecatedAs of Feathers-Pinia v4.2, the storeAssociated
utility has been replaced with a suite of smaller, more-flexible,
single-purpose utilities. See Data Modeling for the new way to store associated data.
The PiniaServiceConfig
interface now accepts a storeName
string. storeName {String}
is the name of the store to use for the service. It defaults to service:${servicePath}
. You can also use storeName
to make two services share the same store.
The PiniaServiceConfig
interface now also accepts an instanceServicePath
string. The instanceServicePath {String}
overrides the service used for instance-level service methods, like patch
, and remove
. This is useful for "proxy" services. For example: pages/full
loads the page record with populated data, but you want to patch/remove the record through the pages
service.
diff
utility is now available in the exports.useFind
internal watch
now uses flush: 'sync'
to prevent an infinite loop during SSR.Published by marshallswain about 1 year ago
It turns out that faulty conditional was saving us from a more serious problem. It caused a large fire when my CPU went up in flames. Just kidding. It just wasn't a simple fix, after all.
Reverts the changes made in this release: https://github.com/marshallswain/feathers-pinia/releases/tag/v3.0.6
Published by marshallswain about 1 year ago
Intended to solve the find
response not being handled, as described in this issue: https://github.com/marshallswain/feathers-pinia/issues/126
Published by marshallswain about 1 year ago
All @feathersjs/
packages have been updated to the latest versions. As a result, some internal types were updated to prevent errors when using the FeathersPinia client.
The documentation has also been updated to show how to ensure all FeathersPiniaService
methods are available for untyped Feathers clients. See the "Common Pitfalls" section on this page: https://feathers-pinia.pages.dev/guide/common-patterns.html
The basic gist is that you need to provide a ServiceTypes generic when calling the feathers()
function:
// import the FeathersService type
import { feathers, type FeathersService } from '@feathersjs/feathers'
// Create a ServiceTypes generic
type ServiceTypes = Record<string, FeathersService>
// Provide `ServiceTypes` in angle brackets before the parentheses
const feathersClient = feathers<ServiceTypes>()
Published by marshallswain over 1 year ago
The included feathers-ofetch adapter was swallowing Feathers errors and turning them into a plain text error. Now the full error from the server is correctly returned from requests.
This didn't have any effect on WebSocket communication, which did not experience the error.
Published by marshallswain over 1 year ago
There are no practical changes for existing users, but this release improves compatibility with some Node.js versions and WebContainers.
Many thanks to @FossPrime! ❤️
Published by marshallswain over 1 year ago
This release moves all @feathersjs
packages to peerDependencies to fix an issue where Types are out of sync every time a new FeathersJS release is published.
Published by marshallswain over 1 year ago
Nothing really noteworthy. Move along. 😁
Published by marshallswain over 1 year ago
This release dramatically simplifies Feathers-Pinia. It applies all best practices from 1.0 and the 2.0 refactor, but basically implicitly does it all for you without getting in the way. All of these changes are encompassed in this release:
useFind
's find
is back, new defaultLimit
optionuseFind
useAuth
Custom Types, update packagesuseFind
not allowing pagination in local modesetupInstance
and configuration mergingPublished by marshallswain over 1 year ago
The syncWithStorage
plugin is now built in and can be enabled in the createPiniaClient
configuration.
Here are some examples. Read more in the documentation:
Here's how to set it up for the entire Feathers-Pinia client instance:
export const api = createPiniaClient(feathersClient, {
idField: '_id',
pinia,
syncWithStorage: true,
storage: window.localStorage,
})
Note that you must provide the global-only storage
option AND the syncWithStorage
option to enable the feature.
Here's how to enable storage sync for a single service:
export const api = createPiniaClient(feathersClient, {
idField: '_id',
pinia,
syncWithStorage: false,
storage: window.localStorage,
services: {
'my-service': {
syncWithStorage: true
}
}
})
You can customize which store keys are synchronized to storage by passing an array to syncWithStorage
. You must
provide all keys, since this will override the default value, which is ['itemsById', 'pagination']
.
export const api = createPiniaClient(feathersClient, {
idField: '_id',
pinia,
syncWithStorage: ['itemsById', 'pagination', 'tempsById'],
storage: window.localStorage,
})
Published by marshallswain over 1 year ago
Fixes a bug where removing an item would cause a temporary item to be created in its place. Only applies to useFind
with paginateOn: 'hybrid'
Published by marshallswain over 1 year ago
defaultLimit
optionA new defaultLimit
option lets you change the default query $limit
to something other than 10
.
useFind
's find
util functionality restored🐜 The params are now cached and called internally when you call find
without any params.
Published by marshallswain over 1 year ago
allLocalData
now shows the correct data during pending state.
Published by marshallswain over 1 year ago
The correct data is now shown while switching pages during pagination.
Published by marshallswain over 1 year ago
The paginateOnServer
option has been changed to paginateOn: 'server'
.
paginateOn
offers three modesclient
is the current default. It's the same as the previous paginateOnServer: false
.server
is the same as the previous paginateOnServer: true
.hybrid
is a combination of server
and client
. It pulls one page at a time from the server while maintaining live lists.useFind
Enable hybrid pagination on useFind
by setting paginateOn: 'hybrid'
. Then you can enjoy server-paginated data while still enjoying live lists.
Hybrid pagination works similar to server
pagination. It keeps track of the current query and the records that were received for it. It then uses the first returned record as a checkpoint while analyzing the $skip
in the query. Here are some starting-point scenarios of how it behaves:
client
pagination.useFind
will recognize that we don't have any records in the store that come before the first record in the current page. This means there's an empty ten-record buffer that needs to be filled before the realtime data will update the live list. This will be made more accurate in the future by watching for created
and patched
events that come in and adjusting the buffer, accordingly.See more details in the test file: https://github.com/marshallswain/feathers-pinia/blob/v3/tests/use-find-get/use-find-hybrid.test.ts
Published by marshallswain over 1 year ago
useAuth
Custom TypesYou can now completely replace AuthenticateData
with a custom type. TypeScript no longer throws a fit when you do this:
interface AuthenticateData {
strategy: 'jwt' | 'local' | 'ldap'
accessToken?: string
tuid?: string
password?: string
}
defineStore('auth', () => {
const utils = useAuth<AuthenticateData>({ api }) // custom type passed in the generic
utils.reAuthenticate()
return { ...utils }
})
Upgrades to the latest FeathersJS release and fixes breaking changes in the latest Vitest update.