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
|
* Basic types only, don't use for anything more than basic equality
|
||||||
*/
|
*/
|
||||||
export function recursiveEqual<T>(
|
export function recursiveEqual<T>(
|
||||||
a: NonNullable<T>,
|
a: T,
|
||||||
b: NonNullable<T>,
|
b: T,
|
||||||
): boolean {
|
): boolean {
|
||||||
if (a === b) return true
|
if (a === b) return true
|
||||||
if (typeof a !== 'object' || typeof b !== 'object') return false
|
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 keysA = Object.keys(a) as (keyof typeof a)[]
|
||||||
const keysB = Object.keys(b) as (keyof typeof b)[]
|
const keysB = Object.keys(b) as (keyof typeof b)[]
|
||||||
|
|
||||||
|
|||||||
@@ -29,9 +29,7 @@ export class Feed<Params, Response> {
|
|||||||
|
|
||||||
async load(params: Params) {
|
async load(params: Params) {
|
||||||
if (
|
if (
|
||||||
this.#lastParams &&
|
!recursiveEqual(params, this.#lastParams)
|
||||||
params &&
|
|
||||||
!recursiveEqual<Params>(params, this.#lastParams)
|
|
||||||
) {
|
) {
|
||||||
this.#data = undefined
|
this.#data = undefined
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user