Weird Failure When Using this.reload(); "Cannot use offset or limit without a model or order being set" #17321
Closed
3 of 6 tasks
Labels
pending-approval
Bug reports that have not been verified yet, or feature requests that have not been accepted yet
type: bug
Issue Creation Checklist
Bug Description
I'm doing a reload call after an increment call.
Reproducible Example
I haven't been able to duplicated this in the SSCCE repo, but by stepping through the source code, I can find where the behaviour starts to get weird.
My debugger shows that in line
sequelize/packages/core/src/model.js
Line 1426 in ab663f5
this.table
is a model table definition, not a table name as expected bythis.queryInterface.select
In the line above https://github.com/sequelize/sequelize/blob/ab663f53be4dc5b085ab815e2c84f68bddfef0a9/packages/core/src/model.js#L1425C5-L1425C70.
tableNames: Object.keys(tableNames)
producestableNames: [ '[object Object]' ]
. The string literal, not the name of the table.Because
sequelize/packages/core/src/model.js
Line 1366 in ab663f5
this.table
is a model table definition not a table name.this.table.tableName
produces the table name as expected.What do you expect to happen?
I expect the reload operation to succeed, without requiring me to pass the order like
What is actually happening?
Somewhere down the line, this.queryGenerator.selectQuery fails the
isModelStatic
check and errors.Environment
Would you be willing to resolve this issue by submitting a Pull Request?
Indicate your interest in the resolution of this issue by adding the 👍 reaction. Comments such as "+1" will be removed.
The text was updated successfully, but these errors were encountered: