Skip to content

ErrorBoundary doesn't call resetError() for new data #604

@ma-efremoff

Description

@ma-efremoff

I am sure it is better to rethink about the condition that wraps call of resetError().

At the moment it has the condition bellow that looks like an error:

if (
                error &&
                'code' in error &&
                [CHARTKIT_ERROR_CODE.NO_DATA, CHARTKIT_ERROR_CODE.INVALID_DATA].includes(
                    String(error.code),
                )
            ) {
                this.resetError();
}

There are several cases which definitely might be fixed by new data:

export const CHARTKIT_ERROR_CODE = {
    NO_DATA: 'ERR.CK.NO_DATA', // might be fixed by a new `data`
    INVALID_DATA: 'ERR.CK.INVALID_DATA', // might be fixed by a new `data`
    UNKNOWN: 'ERR.CK.UNKNOWN_ERROR', // might be fixed by a new `data`
    UNKNOWN_PLUGIN: 'ERR.CK.UNKNOWN_PLUGIN', // the only case to freeze 
    TOO_MANY_LINES: 'ERR.CK.TOO_MANY_LINES', // might be fixed by a new `data`
};

Any chart absolutely should not freeze with TOO_MANY_LINES, a user may touch some filter-controls to reduce size of data. The same is actual to other cases except UNKNOWN_PLUGIN.

Actually depending on client code even UNKNOWN_PLUGIN might be fixed by new data if for example chart-type is changed. The best approach is to call resetError for every new data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions