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
The custom message works for POST requests with the same set of related data, but not for PUT requests. When sending a PUT request from a related data edit form, it has the following behavior:
When receiving a 400 response, the UI "blinks" and shows no message.
When receiving a 200 response, the UI displays a brief generic "success" message, and then returns to the related data list page.
Failure Logs
For Valid Requests w/ Custom 200 Response
Here's an example valid update PUT request and the custom response
Instead of displaying the message "Survey question list updated", the message displayed is:
Which is just the default message for this related data type.
For Invalid/Failed Requests w/ Custom 400 Response
When sending a failed request such as the following...
Request URL: http://localhost:5000/forest/Survey/5ada0e46c38fd399899c9dfa/relationships/questionList/18
Request Method: PUT
Status Code: 400 Bad Request
Remote Address: [::1]:5000
Referrer Policy: no-referrer-when-downgrade
RESPONSE
{"error":"Survey validation failed: questions.18.sortOrder: Path `sortOrder` (-22) is less than minimum allowed value (0)."}
...no message at all is shown. The UI flickers and stays on the same view.
Context
Using Mongo 3.6 with forest-express-mongoose package.
Package Version: 2.8.2
Express Version: 4.16.3
The text was updated successfully, but these errors were encountered:
Hi @arnaudbesnier - you're absolutely right, this is a "native" action that I've overridden, not a "smart" action.
Use case is that I need to be able to edit items in a smart field of related data, and the default form created includes fields that are read-only, as well as virtual fields, and thus I need to be able to selectively update the document. Ideally I'd be able to customize that edit form more explicitly, but that's a separate story.
Is there any way to customize the messages returned for a "native" action that has been overwritten? If not, then this issue is moot.
arnaudbesnier
changed the title
Customized response fails to appear for PUT smart action in related data
API Override - Customized response fails to appear for PUT actions in related data
Oct 21, 2018
Expected behavior
When editing the content of a record in a "related data" set that triggers a custom action, I would expect the custom response from that action to be rendered as a message in the same manner as is specified at https://doc.forestadmin.com/developer-guide/express-mongoose.html#customizing-response.
Actual behavior
The custom message works for
POST
requests with the same set of related data, but not forPUT
requests. When sending aPUT
request from a related data edit form, it has the following behavior:400
response, the UI "blinks" and shows no message.200
response, the UI displays a brief generic "success" message, and then returns to the related data list page.Failure Logs
For Valid Requests w/ Custom 200 Response
Here's an example valid update
PUT
request and the custom responseInstead of displaying the message "Survey question list updated", the message displayed is:
Which is just the default message for this related data type.
For Invalid/Failed Requests w/ Custom 400 Response
When sending a failed request such as the following...
...no message at all is shown. The UI flickers and stays on the same view.
Context
Using Mongo 3.6 with
forest-express-mongoose
package.The text was updated successfully, but these errors were encountered: