Releases: morrys/wora
[email protected]
Breaking change
- ApolloClientIDB.create function #22
public static create(
config: ApolloClientIDBOptions,
options: {
cacheOptions?: InMemoryCacheConfig;
persistOptions?: CacheOptions;
offlineStoreOptions?: CacheOptions;
idbOptions?: {
name?: string;
onUpgrade?: IOnUpgrade;
version?: number;
};
},
): ApolloClientOffline
Improved
-
added broadcastQueries when client is rehydrated
-
added useQuery #23
the useQuery provides native management of client hydration.
If the client is not hydrated, the hydration request is made and the application will have the same behavior as when it is offline and will be rendered with only the information present in the store if present.
When the hydration promise is resolved, the useQuery is re-rendered.
import useQuery from '@wora/apollo-offline/lib/react/useQuery';
Fixed
- ApolloClientIDB is not passing all cache-persist options #22
[email protected]
Improved
- update wora/cache-persist dependency
[email protected]
Breaking change
- renamed restore function in hydrate
- update peerDependency "relay-runtime": ">=6.0.0"
Improved
- support relay v6 & v7
- improved SSR management
Fixed (1.0.1 / 1.0.2)
- update dependency cache-persist
[email protected]
Breaking change
- renamed restore function in hydrate
- removed offlineOptions in constructor
- removed isRestored function, now exist only isRehydrated
- removed: automatic rollback management of the single failed mutation in the store (relay v6 & v7 no longer allows such integration)
- update peerDependency "relay-runtime": ">=6.0.0"
Improved (2.0.0)
- support relay v6.0.0 & v7.0.0
- added setOfflineOptions
- update dependency offline-first with new options
import { Network } from "relay-runtime";
import { RecordSource, Store, Environment } from "react-relay-offline";
const network = Network.create(fetchQuery);
const networkOffline = Network.create(fetchQueryOffline);
const manualExecution = false;
const recordSource = new RecordSource();
const store = new Store(recordSource);
const environment = new Environment({ network, store });
environment.setOfflineOptions({
manualExecution, //optional
network: networkOffline, //optional
start: async (mutations) => { //optional
console.log("start offline", mutations);
return mutations;
},
finish: async (mutations, error) => { //optional
console.log("finish offline", error, mutations)
},
onExecute: async (mutation) => { //optional
console.log("onExecute offline", mutation)
return mutation;
},
onComplete: async (options ) => { //optional
console.log("onComplete offline", options)
return true;
},
onDiscard: async ( options ) => { //optional
console.log("onDiscard offline", options)
return true;
},
onPublish: async (offlinePayload) => { //optional
console.log("offlinePayload", offlinePayload)
return offlinePayload
}
});
Fixed (2.0.1 / 2.0.2)
* update dependency cache-persist
[email protected]
Improved (2.0.0)
new offline-first options (#14)
export type OfflineFirstOptions<T> = {
manualExecution?: boolean;
execute: (offlineRecord: OfflineRecordCache<T>) => Promise<any>;
start?: (mutations: Array<OfflineRecordCache<T>>) => Promise<Array<OfflineRecordCache<T>>>;
finish?: (mutations: ReadonlyArray<OfflineRecordCache<T>>, error?: Error) => Promise<void>;
onExecute?: (mutation: OfflineRecordCache<T>) => Promise<OfflineRecordCache<T>>;
onComplete?: (options: { offlineRecord: OfflineRecordCache<T>; response: any }) => Promise<boolean>;
onDiscard?: (options: { offlineRecord: OfflineRecordCache<T>; error: any }) => Promise<boolean>;
onPublish?: (offlineRecord: OfflineRecordCache<T>) => Promise<OfflineRecordCache<T>>;
compare?: (v1: OfflineRecordCache<T>, v2: OfflineRecordCache<T>) => number;
};
- added setOfflineOptions
- added start & onExecute options
- removed offlineOptions in constructor
- renamed restore function in hydrate
- changed all return options function in promises
- changed finish options, before: finish(isSuccess, mutations) after: finish(mutations, error)
- code optimization
Fixed (2.0.1 / 2.0.2)
- update dependency cache-persist
[email protected]
Fixed
Now the cache does not perform any storage operation until the restore is performed. The cache status is used to evaluate the initialState in the mergeState function. (#16)
- changed the mergeState function mergeState ?: (restoredState ?: DataCache, initialState ?: DataCache) => Promise | DataCache;
[email protected]
Breaking change
- renamed hydrated function in hydrate
- removed offlineOptions in constructor
Improved (2.0.0)
- added setOfflineOptions
- update dependency offline-first with new options #14
- optimization in saving backup data within the offline mutation. Only the modified elements are saved in the backup property.
import { ApolloClient } from "@wora/apollo-offline";
import { HttpLink } from "apollo-link-http";
import ApolloCache from '@wora/apollo-cache';
const httpLink = new HttpLink({
uri: "http://localhost:4000/graphql"
});
const httpLinkOffline = new HttpLink({
uri: "http://localhost:4000/graphql"
});
const client = new ApolloClient({
link: httpLink,
cache: new ApolloCache({
dataIdFromObject: o => o.id
})
});
client.setOfflineOptions({
manualExecution: false, //optional
link: httpLinkOffline, //optional
start: async (mutations) => { //optional
console.log("start offline", mutations);
return mutations;
},
finish: async (mutations, error) => { //optional
console.log("finish offline", error, mutations)
},
onExecute: async (mutation) => { //optional
console.log("onExecute offline", mutation)
return mutation;
},
onComplete: async (options ) => { //optional
console.log("onComplete offline", options)
return true;
},
onDiscard: async ( options ) => { //optional
console.log("onDiscard offline", options)
return true;
},
onPublish: async (offlinePayload) => { //optional
console.log("offlinePayload", offlinePayload)
return offlinePayload
}
};)
// await before instantiating Query, else queries might run before the cache is persisted, TODO ApolloProviderOffline
await client.hydrate(): Promise<boolean>
Fixed (2.0.1 / 2.0.2)
- update dependency cache-persist
[email protected]
Breaking change
- renamed hydrated function in hydrate
Improved
- improved cache management
Fixed (1.0.1 / 1.0.2)
- update dependency cache-persist
[email protected]
Improved
-
@wora/[email protected]
- SSR support
-
@wora/[email protected]
- updated wora/netinfo dependency
-
@wora/[email protected]
- updated wora/netinfo dependency
-
@wora/[email protected]
- updated wora/netinfo dependency
-
@wora/[email protected]
- updated wora/netinfo dependency
[email protected] & Others
-
Release
- @wora/[email protected]
- @wora/[email protected]
- @wora/[email protected]
- @wora/[email protected]
- @wora/[email protected]
- @wora/[email protected]
-
Improved
- wora/redux: modified the redux library to natively manage persistence and reduce the size of the bundle
- wora/cache-persist
- possibility of using any storage synchronously with the read and write performance that you have with javascript objects (queue debounce merge and the invocations of multiSet and multiRemove)
- use react-native-community/async-storage and eliminate the dependency from the AsyncStorage of react-native
- compatibility with storage created for redux
- fix typo
- improved handling of the disablePersist
- manage set, remove. delete through queue
- test with jest
- #11 (comment)
- wora/relay-store
- updated wora/cache-persist dependency
- moved the creation of the recordsource out of the store
- eslint
- wora/apollo-cache
- updated wora/ cache-persist dependency
- eslint
-
wora/offline-first
- updated wora/cache-persist dependency
- eslint
-
wora/relay-offline
- updated wora/cache-persist dependency
- updated wora/offline-first dependency
- updated wora/relay-store dependency
-
wora/apollo-offline
- updated wora/cache-persist dependency
- updated wora/offline-first dependency
- updated wora/apollo-cache dependency
-
Breaking Change
-
wora/cache-persist
- changed types
- set, remove, delete, purge & replace methods are no longer of the promise, now they are all synchronous
-
modified the parameters of the subscribe and notify functions
-
wora/relay-store
-
before
import { Store } from '@wora/relay-store';
const defaultTTL: number = 10 * 60 * 1000,
const persistOptions: CacheOptions = {};
const persistOptionsRecords: CacheOptions = {};
const store = new Store(defaultTTL, persistOptions, persistOptionsRecords);
after
import { RecordSource, Store } from '@wora/relay-store';
import { CacheOptions } from "@wora/cache-persist";
const persistOptions: CacheOptions = {
defaultTTL
};
const persistOptionsRecords: CacheOptions = {};
const recordSource = new RecordSource(persistOptionsRecords);
const store = new Store(recordSource, persistOptions);
- wora/relay-offline
- modified EnvironmentIDB.create signature