addItem returns resolved promise object instead of added item with the autoIncrement key
See original GitHub issueGreetings. I’m using ngx-indexed-db with a ng 11 project with the following packages:
"dependencies": {
"@amcharts/amcharts4": "^4.10.17",
"@angular/animations": "11.1.1",
"@angular/cdk": "11.1.1",
"@angular/common": "11.1.1",
"@angular/compiler": "11.1.1",
"@angular/core": "11.1.1",
"@angular/forms": "11.1.1",
"@angular/platform-browser": "11.1.1",
"@angular/platform-browser-dynamic": "11.1.1",
"@angular/router": "11.1.1",
"@angular/service-worker": "11.1.1",
"@fortawesome/fontawesome-free": "5.15.1",
"@microsoft/signalr": "^3.1.6",
"@ngx-translate/core": "13.0.0",
"@ngx-translate/http-loader": "6.0.0",
"@syncfusion/ej2-angular-buttons": "19.1.63",
"@syncfusion/ej2-angular-calendars": "19.1.64",
"@syncfusion/ej2-angular-dropdowns": "19.1.64",
"@syncfusion/ej2-angular-filemanager": "19.1.63",
"@syncfusion/ej2-angular-grids": "19.1.64",
"@syncfusion/ej2-angular-inputs": "19.1.63",
"@syncfusion/ej2-angular-navigations": "19.1.63",
"@syncfusion/ej2-angular-popups": "19.1.64",
"@syncfusion/ej2-layouts": "19.1.63",
"@syncfusion/ej2-locale": "19.1.54",
"@syncfusion/ej2-notifications": "19.1.63",
"angular-archwizard": "^6.1.0",
"angular-gridster2": "^11.0.0",
"bootstrap": "4.5.3",
"classlist": "2.0.0",
"cldr-data": "^36.0.0",
"intl": "1.2.5",
"jwt-decode": "^3.1.1",
"lodash": "4.17.20",
"modernizr": "3.11.7",
"ng-dynamic-component": "8.0.1",
"ngx-bootstrap": "^6.2.0",
"ngx-extended-pdf-viewer": "8.3.0",
"ngx-indexed-db": "^9.1.2",
"ngx-toastr": "^13.2.1",
"ngx-webcam": "^0.3.0",
"print-js": "^1.5.0",
"rxjs": "~6.6.0",
"screenfull": "5.0.2",
"simple-line-icons": "2.5.5",
"source-sans-pro": "3.6.0",
"spinkit": "2.0.1",
"tslib": "^2.0.0",
"zone.js": "0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "0.1101.1",
"@angular/cli": "11.1.1",
"@angular/compiler-cli": "11.1.1",
"@types/jasmine": "~3.6.0",
"@types/node": "^12.11.1",
"codelyzer": "^6.0.0",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~6.1.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"protractor": "~7.0.0",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~4.1.5"
}
In the context of a store with autoincrement key “Id”, with the following setup:
{
store: veicoliStore,
storeConfig: { keyPath: 'Id', autoIncrement: true },
storeSchema: [
{ name: 'VAN', keypath: 'VAN', options: { unique: true } },
{ name: 'Categoria', keypath: 'Categoria', options: { unique: false } },
]
},
If I try to do a bulk add (with a single element), everything seems to work fine: the array containing the Id of the single element which was added to the store is correctly returned:
Instead, if I perform a normal insert, with addItem, according to the API specification, I would expect the item with the autoassigned key to be returned. Instead, what I get back looks completely different:
Why is that so? Am I missing something?
Thank you
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Why does Chrome console return Promise object from .then ...
As expected, myAsync returns a promise, but when I call .then() (i.e. myAsync().then(res => res) ), then console displays Promise{<fulfilled>: ...
Read more >Promise.resolve() - JavaScript - MDN Web Docs
Return value. A Promise that is resolved with the given value, or the promise passed as value, if the value was a promise...
Read more >upsert across HTTP requests has a race condition · Issue #3242
I want to create or update an object of the model with upsert and check if the object exists by searching for the...
Read more >the deferred dom node could not be resolved - You.com
Every Ajax method of jQuery already returns a "deferred object" (actually a promise of a deferred object) which you can just return from...
Read more >How to Build an Ionic 4 App with SQLite Database & Queries ...
To get started we create a blank new app, add two pages and a service ... NOT EXISTS product(id INTEGER PRIMARY KEY AUTOINCREMENT,name...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @Y3kRulez, for this method (addItem) there is an issue, that will be solved as soon as possible. If you need to insert an element and have the inserted element as a return, I suggest you use (for the moment) the bulkAdd.
any update on this? Thanks!