-
-
Notifications
You must be signed in to change notification settings - Fork 32
Related items module #191
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
base: main
Are you sure you want to change the base?
Related items module #191
Conversation
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.
Hey @timio23! Great work 🚀 I really like this extension ❤️
However, besides the code comments, I found the following bugs:
- As soon as we open a junction collection (M2M or M2A), we get an error on the server, but not in the studio. From that point on, nothing works and we have to restart Directus. Please be sure to include proper error handling so that the server does not crash!
- If I have an M2A on a collection and also the Related Items interface. When I then click on an item in the M2A and edit it in the drawer, then open the same item in the Related Items interface, I get the same error on the server as above.
- Settings are not reactive, so we have to refresh the browser after updating.
- If there are no related items, the interface will display a gray box with a loading cursor. Please display a notice instead: No (related) items found or similar.
- M2A bug: Given a main collection with an M2A field that references other collections, but also the main collection itself. Then, when creating an item with references to all collections except the main collection, it shows a tab with all items but 4 occurrences of each. When I open one in the drawer, I get the same, but with 8 more.
- A similar bug occurs, when clicking on a related item from your interface and then in the opened drawer where we also have this interface, switching tabs between “All” and a collection that has an M2A relationship to the main collection. When switching tabs, the items on the “All” tab are duplicated each time, we activate it.
- Even if we display only 1 item, the list will appear
densed
based on the total number of items. - If you click on the label of the interface to edit a raw value, this value is added to the form values and the save button becomes active. Please be sure to prevent this by setting
hideLabel: true
in the interface settings!- On the other hand, when opening a related item in the drawer that is not present as a reverse relationship/interface and then editing this item, we see the edits updated in the interface, but the value is not stored so we can save it. With the above in mind, please find a solution to either prevent editing or allow it and make it work properly.
packages/related-items-bundle/src/related-items-module/index.ts
Outdated
Show resolved
Hide resolved
packages/related-items-bundle/src/related-items-module/settings-field.ts
Outdated
Show resolved
Hide resolved
packages/related-items-bundle/src/related-items-interface/related-items-list.vue
Outdated
Show resolved
Hide resolved
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.
Hey @timio23, Here are some more change requests from the design team:
Please swap the colors so that the button is the primary color and the badge is the primary accent color.
For the dropdown menu in Settings, please ensure that the menu width matches the field width. If the wider field already solves this issue, then ignore this.
Thank you!
Update from me, I've got most of these sorted but still working through the more complex issues |
Hi @formfcw, you mentioned getting errors when adding the interface to a junction table. Is there a use case for this? It would only show what is already available - eg one item from the left and one item from the right. Any objections to me excluding junction tables from the settings? |
The server crashes and needs to be restarted. We need a solution to this problem. It's up to you whether that means preventing usage in junction tables or making the interface work. |
Hey @formfcw, I've resolved most of the issues and requests. There's just one I'm stuck on - the reactive settings. I used a hook extensions to create the fields when the settings are updated however this runs on the server side and can't hydrate the fields on behalf of the user. Are you aware of another way to trigger hydration after settings are saved? |
packages/related-items-bundle/src/related-items-interface/utils/get-route.ts
Show resolved
Hide resolved
packages/related-items-bundle/src/related-items-interface/related-items-list.vue
Outdated
Show resolved
Hide resolved
packages/related-items-bundle/src/related-items-interface/related-items-list.vue
Outdated
Show resolved
Hide resolved
packages/related-items-bundle/src/related-items-interface/related-items-list.vue
Outdated
Show resolved
Hide resolved
packages/related-items-bundle/src/related-items-interface/related-items-list.vue
Outdated
Show resolved
Hide resolved
packages/related-items-bundle/src/related-items-interface/related-items-list.vue
Show resolved
Hide resolved
/> | ||
</template> | ||
|
||
<style lang="css" scoped> |
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.
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.
added css to fix alignment
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.
packages/related-items-bundle/src/related-items-module/settings-field.ts
Show resolved
Hide resolved
Also, please take a look at the unresolved issues listed above:
|
@formfcw that should be all the issues resolved now |
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.
Thank you @timio23 for your changes!
A few things:
- Please fix the alignment as described above
- Given that we have an M2A builder interface and the Related Items Extension on the same item. When we edit an item in the M2A the changes are not reflected in the Related Items Interface. However, if we then open the same item via the Related Items Interface and edit the field, it will be saved, but not updated in the M2A interface, where the previous edits still exist. Please, either make it behave as expected or you set the form in the drawer to appear as read-only. To do so, simply add a
disabled
prop to<drawer-item>
and remove the unused parts (saveEdits, …). - We are still having trouble with duplicate entries appearing when switching tabs — see the video:
duplicates.mov
Hi @formfcw, I can't seem to replicate this issue. I've tested on Safari, Chrome and Firefox using a vanilla installation of Directus 11 and it's all working correctly including the API response. From the video, it seems that some results are "sticking", is there anything unique about your set up? I'm testing use Postgres and SQLite with the browsers mentioned above on my Mac. Maybe another extension is interfering? |
No description provided.