[RFR] Send API request on reference auto-complete#508
Conversation
There was a problem hiding this comment.
You don't need parentheses for a single argument
|
Switching to RFR. I still need to test it on a real world project before merging. |
890aa93 to
f4e695d
Compare
|
Tested on real world project. Seems to work. Removing the [DO NOT MERGE]. |
There was a problem hiding this comment.
I'm surprised this works, I had to return a function because Angular complained about an infinite look. Needs further testing.
|
If you have to put some API fetching logic in a directive, please move it to a service. |
There was a problem hiding this comment.
Something bothers me: users can't opt out for ajax autocompletion. That means that if their API doesn't implement the search query param, reference fields cease to work. This is a serious BC break.
Autocomplete should be opt-in ; the default behavior should still be to fetch all possible values, and only autocomplete locally.
There was a problem hiding this comment.
Actually, this is already dealt through the field.refreshDelay parameter. If it's null, then all choices would be retrieved, the same as before my changes.
I put the API request behavior by default, as it sounds more logical to me for references. Indeed, user doesn't know how many records there is remotely. And it is more probable that there is a lot. It would then be limited by the perPage parameter.
This is indeed a BC break, but it improves the component behavior IMO.
There was a problem hiding this comment.
As seen with @fzaninotto, we'll set refreshDelay to null by default.
There was a problem hiding this comment.
Moreover, you must make it more explicit that in the doc that a Reference is populated by the entire list of references, and that if the developer wants to use autocomplete, they should set the refreshdelay to something more than null.
|
Refresh logic moved to a dedicated service. Ready for another review. |
|
Is it possible to disable first request (in routing) for retrieving references values in case of |
|
Back to WIP for optimizing number of sent requests and to fix autocomplete, which seems to be made only on local records. |
|
Ready for review. Failing tests are due to the admin-config PR. |
|
👍 |
[RFR] Send API request on reference auto-complete
|
Great work, thanks a lot! |
|
Hey guys! Is there any way to get the Check out this example: What could I do? |
|
@endel: not for now. But this |
Instead of having a pre-define set of choices in reference fields, send API requests at will to fetch related records.
Left tasks:
refreshDelay