Skip to content

DataService. _performAndDeleteOfflineOperation incorrectly null checks for offlineService and schema #2019

@tejaede

Description

@tejaede

The logic of the following section of DataService. _performAndDeleteOfflineOperation is logically inconsistent.

            if (this.offlineService) {
                tableSchema = this.offlineService.schema[operationType];
                foreignKeys = tableSchema.foreignKeys;
            }

            if (!foreignKeys) {
                foreignKeys = tableSchema._computedForeignKeys ||
                    (tableSchema._computedForeignKeys = Object.keys(operation.changes));
            }

https://github.com/montagejs/montage/blob/master/data/service/data-service.js#L2395-L2404

If this.offlineService is undefined, tableSchema and foreignKeys will not be set in the first conditional. That forces the code to throw in the second condition. !foreignKeys is true so the code enters the block and tableSchema is necessarily undefined.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions