Looking to capture and store user feedback or team discussions directly within your Retool App? We'll show you how to save those valuable insights into Retool Database! Whether you're tracking progress, gathering feedback, or just keeping a record of your conversations, this step-by-step process will have you set up in no time.
We'll be using additionalScope. If this is a new concept for you, visit that link first. Here is also a TLDR if you just need a refresher:
Let’s make your app even more collaborative in just three simple steps!
Create a table on Retool Database (i.e. "comments"). Create a column for the body, and in order to reference the user who sent it, create columns for user_id, name, email, or other references we may need. Here is an example:
At the App level, create a 'Resource query' to write data to our new table:
Note: the values for name and user_id are passed dynamically based on who is logged in, we send the comment's body using "additionalScope."
Add an event handler to the 'Comment Thread' component for the 'Submit' event, and run a script to trigger the query to POST the comment, passing the Comment Thread's value as the body.
This is a workaround for a feature that isn’t currently natively supported in Retool. While you can delete or edit comments at the database level, these changes won’t reflect in the actual Comment Thread component. The reason is that the component currently doesn't support editing comments or triggering events when a comment is deleted. When this is possible, I'll be happy to come back and update this guide.
Still no timeline on this yet! Since releasing the v2, we've been getting the feature requests and no future plans for this component yet.
I agree that getting your own store for comments is great, and the ability to disable+adding callbacks to delete is great would be great addition, and these are all top of the list items we are tracking for comments feature requests.
I'm glad that @MiguelOrtiz found a workaround to mirror the comments perhaps by submit handler? Very clever! To hack around the lack of disable delete today, I think you might be able to use custom CSS to hide the button.
Sorry to bug you with this, any chance you would help out on the best way to target the delete button in the new thread component? I really haven't done my homework and learned the best way of doing it as per your really informative post some time ago.
Hey @MiguelOrtiz sorry for the late reply on this!
If I'm understanding your requirements correctly, you're wanting to have a comment thread with more flexibility to be able to add, edit, and delete comments and/or replies, correct?
If so, the only way I was able to figure out how to do this was by placing a list view component within another list view component -- which I would not recommend if at all possible as things tend to get buggy when placing a list view within another list view
Once I got it technically working properly, was when this new comment thread component became readily available. It covered the use case in which I needed it for, so I switched over to that for simplicity
However, if you were still curious and having a list view within another listview isn't a concern for you, I'd be happy to share my solution!
So for this specific request I jsut want to be able to hide/remove the delete button in the new thread component so that users can't delete comments. The edit replies is something I can live with for now.
For a chat component in the future I'm planning and looking forward to use what @MarkOfRespect and the Weavy team have to offer
Ahh I see the difference lies in how my company Retool account's comment thread component must come different out of the box than it does from how it comes out of the box in the account you are working within.
Does targeting it how I specified above not work like so?