fix: community load error undefined
This commit is contained in:
2 files changed
+8
-5
No files matched your search
@@ -195,12 +195,17 @@ export const userLink = (person: Person, prefix: string = '') =>
|
||||
* Basic types only, don't use for anything more than basic equality
|
||||
*/
|
||||
export function recursiveEqual<T>(
|
||||
a: NonNullable<T>,
|
||||
b: NonNullable<T>,
|
||||
a: T,
|
||||
b: T,
|
||||
): boolean {
|
||||
if (a === b) return true
|
||||
if (typeof a !== 'object' || typeof b !== 'object') return false
|
||||
|
||||
if (a == null || b == null) {
|
||||
if (a == null && b == null) return true
|
||||
else return false
|
||||
}
|
||||
|
||||
const keysA = Object.keys(a) as (keyof typeof a)[]
|
||||
const keysB = Object.keys(b) as (keyof typeof b)[]
|
||||
|
||||
|
||||
@@ -29,9 +29,7 @@ export class Feed<Params, Response> {
|
||||
|
||||
async load(params: Params) {
|
||||
if (
|
||||
this.#lastParams &&
|
||||
params &&
|
||||
!recursiveEqual<Params>(params, this.#lastParams)
|
||||
!recursiveEqual(params, this.#lastParams)
|
||||
) {
|
||||
this.#data = undefined
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user