Merge remote-tracking branch 'upstream/dev' into immediate-finds

This commit is contained in:
Nuckyz 2024-05-07 16:27:52 -03:00
commit 94843a77ac
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9
2 changed files with 8 additions and 7 deletions

View file

@ -63,7 +63,6 @@ export const DraftStore = findStore<t.DraftStore>("DraftStore");
/**
* React hook that returns stateful data for one or more stores
* You might need a custom comparator (4th argument) if your store data is an object
*
* @param stores The stores to listen to
* @param mapper A function that returns the data you need
* @param dependencies An array of reactive values which the hook depends on. Use this if your mapper or equality function depends on the value of another hook
@ -71,9 +70,4 @@ export const DraftStore = findStore<t.DraftStore>("DraftStore");
*
* @example const user = useStateFromStores([UserStore], () => UserStore.getCurrentUser(), null, (old, current) => old.id === current.id);
*/
export const useStateFromStores = find(filters.byProps("useStateFromStores"), m => m.useStateFromStores) as <T>(
stores: t.FluxStore[],
mapper: () => T,
dependencies?: any[] | null,
isEqual?: (old: T, newer: T) => boolean
) => T;
export const useStateFromStores = find<t.useStateFromStores>(filters.byProps("useStateFromStores"), m => m.useStateFromStores);

View file

@ -182,3 +182,10 @@ export class GuildStore extends FluxStore {
getRoles(guildId: string): Record<string, Role>;
getAllGuildRoles(): Record<string, Record<string, Role>>;
}
export type useStateFromStores = <T>(
stores: t.FluxStore[],
mapper: () => T,
dependencies?: any,
isEqual?: (old: T, newer: T) => boolean
) => T;