-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Feat/1246 allow reordering complex form components #1385
base: develop
Are you sure you want to change the base?
Feat/1246 allow reordering complex form components #1385
Conversation
a299fa5
to
de7e10e
Compare
private class SensesDiffApi(IMiniLcmApi api, Guid entryId) : IOrderableCollectionDiffApi<Sense> | ||
private class ComplexFormComponentsDiffApi(Entry afterEntry, IMiniLcmApi api) : IOrderableCollectionDiffApi<ComplexFormComponent> | ||
{ | ||
private readonly bool supportsEntityIds = api.GetDataFormat() == ProjectDataFormat.Harmony; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really don't like this (and the code which is conditional on this). What if we used Id everywhere, and the Fw version set the component Id to the right thing based on context? eg: either the ComponentSense??EntryId or ComplexFormEntryId.
{ | ||
if (supportsEntityIds) between = MapBackToEntityIds(between); | ||
var componentId = supportsEntityIds ? component.Id : component.ComponentSenseId ?? component.ComponentEntryId; | ||
await api.MoveComplexFormComponent(afterEntry.Id, componentId, between); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah this won't work. Imagine a client (fw lite, or FLExTools) calling MoveComplexFormComponent directly. What does it pass in to the 2nd arg? component.Id? or component.ComponentEntryId? It depends on GetDataFormat, that really sucks. See my comment above for how we might fix this
…es, even after they are modified
…mplementation for IOrderableCollectionDiffApi.GetId
…d a comment in the file documenting its purpose
Notable changes:
ComplexEntryComponent
s, so that I didn't need to makeBetweenPosition
generic. You actually only need 1 Guid. If you're comparing complex-forms then you can use the complex-form ID. If you're comparing components then you usecomponentSenseId ?? componentEntryId
, so you get the most specific one. For CRDTs it can be mapped back to theComplexEntryComponent.Id
before entering the API.GetDataFormat()
to the MiniLcmApi in order to distinguish the two cases ☝️CanInsertComplexFormComponentViaSync
proved to be a super valuable test. What cases passed and failed changed constantly as I was fleshing out the Fw implementation.