You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When performing several nested eager loading of parents along the same OptionalParent relationship, it crashes in ThroughOptionalParentEagerLoader run() (fatal error: Unexpectedly found nil while unwrapping an Optional value: file fluent-kit/Sources/FluentKit/Properties/OptionalParent.swift, line 153) when reaching the last parent that has no valid parent and attempting again to eager load this non existing parent:
public final class ZoneRecord : Model, Content {
…
@OptionalParent(key: "parent_id")
public var parent : ZoneRecord?
…
}
return ZoneRecord.query(on: req.db)
.filter(\.$id == id)
.with(\.$parent) {
$0.with(\.$parent) {
$0.with(\.$parent)
}
}
.first()
Example:
ZoneRecord id = 1, parent_id=nil
ZoneRecord id = 2, parent_id=1
ZoneRecord id = 3, parent_id=2
If I perform the query for a ZoneRecord that has a valid parent and grand parent it works as expected (e.g. id = 3 above), but for one that has only one parent and no grand-parent it will crash (E.g id = 2 above).
When performing several nested eager loading of parents along the same OptionalParent relationship, it crashes in ThroughOptionalParentEagerLoader run() (fatal error: Unexpectedly found nil while unwrapping an Optional value: file fluent-kit/Sources/FluentKit/Properties/OptionalParent.swift, line 153) when reaching the last parent that has no valid parent and attempting again to eager load this non existing parent:
Example:
ZoneRecord id = 1, parent_id=nil
ZoneRecord id = 2, parent_id=1
ZoneRecord id = 3, parent_id=2
If I perform the query for a ZoneRecord that has a valid parent and grand parent it works as expected (e.g. id = 3 above), but for one that has only one parent and no grand-parent it will crash (E.g id = 2 above).
Fluent-Kit: 1.0.0-rc.1.8
fluent-postgres-driver 2.0.0-rc.1
The text was updated successfully, but these errors were encountered: