mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-13 23:23:29 +01:00
ListMonitor refetch does not allow "Fetch Chain builders" #204
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @demonar on GitHub (Apr 2, 2018).
i'm updating the implementation on a project and found that when trying to update the old fashioned where, order, tweak clauses to the new form, i'm not allowed, but on the monitorList method i still can, this leaves a mix of styles in the code, if i were to parametrize some of the clauses to recall them i couldn't as they're not compatible, is there a way to add this in the future?
@JohnEstropia commented on GitHub (Apr 14, 2018):
@demonar Hi, can you give more information on what you tried that didn't work?
@demonar commented on GitHub (Apr 15, 2018):
lets say i have this monitor:
typealias ListEntityType = SomeEntitylet monitor = appStack.dataStack.monitorList(From<ListEntityType>().where(\.someProperty == false &&\.someOtherProperty == true &&\.someMoreProperty == myValue ?? "").orderBy(.descending(\.created), .descending(\.elementId)).tweak { $0.fetchBatchSize = 20 })and after an update i need to refetch:
self.monitor.refetch(Where<ListEntityType>("someProperty", isEqualTo: false) &&Where<ListEntityType>("someOtherProperty", isEqualTo: true) &&Where<ListEntityType>("someMoreProperty", isEqualTo: otherElement.name),OrderBy<ListEntityType>(.descending("created"), .descending("elementId")),Tweak { $0.fetchBatchSize = 20 })as you can see i need to do it the old fashioned way as the refetch method does not allow the chain builder
@JohnEstropia commented on GitHub (Dec 5, 2018):
It's been many months and I apologize that this issue got buried. Looking back into
refetch(), it's not really compatible with fetch builders because of it's special nature:FetchClausethat you specify, which means it keeps the old clauses for those you didn't specifyWhere,OrderBy, andTweakclauses.Due to these the current
refetch()API being "old fashioned" is by design.