Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apparent infinite loop with many to many relationship and preload: true #283

Open
JWambaugh opened this issue Oct 9, 2022 · 0 comments
Open

Comments

@JWambaugh
Copy link

If I query a table with a many-to-many relationship and use .toList(preload: true), the query never returns if retrieving a record with related records. It looks like it gets stuck in an infinite loop.

A simplified version of my model for example:

const tableImage = SqfEntityTable(
    tableName: 'image',
    primaryKeyName: 'id',
    primaryKeyType: PrimaryKeyType.integer_auto_incremental,
    useSoftDeleting: false,
    modelName: null,
    fields: [
      SqfEntityField('fileName', DbType.text),
    ]);

const tableAlbums = SqfEntityTable(
    tableName: 'album',
    primaryKeyName: 'id',
    primaryKeyType: PrimaryKeyType.integer_auto_incremental,
    useSoftDeleting: false,
    modelName: null,
    fields: [
      SqfEntityField('name', DbType.text),

      SqfEntityFieldRelationship(
        parentTable: tableImage,
        relationType: RelationType.MANY_TO_MANY,
        manyToManyTableName: "albumImage",
        deleteRule: DeleteRule.CASCADE,
      )
    ])

then for example if I run:

return await Image().select().toList(preload: true); // <- never returns
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant