Skip to content
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

Pre-fetch user groups for autocomplete #42

Open
boonebgorges opened this issue May 12, 2015 · 4 comments
Open

Pre-fetch user groups for autocomplete #42

boonebgorges opened this issue May 12, 2015 · 4 comments
Assignees
Milestone

Comments

@boonebgorges
Copy link
Member

We've had a report in testing about lag when fetching groups via autocomplete. Most people will be a member of fairly few few groups, so how about just loading them all into a JS object on pageload, and avoiding AJAX altogether? Only question would be what to do about super admins - maybe tack an item to the end of the suggestion list "Search all site groups", which would fire an AJAX request.

@boonebgorges boonebgorges added this to the 2.0 milestone May 12, 2015
@r-a-y
Copy link
Member

r-a-y commented May 12, 2015

I hardcoded a delay of 500ms to the AJAX lookup to prevent too much querying. Perhaps I can drop this value in half?
https://github.com/cuny-academic-commons/bp-event-organiser/blob/master/assets/js/group-select.js#L77

@boonebgorges
Copy link
Member Author

I suppose this would be OK, but it also means that no results will be
returned in some cases, right? That seems like a dead end.

On 05/12/15 12:16, r-a-y wrote:

I hardcoded a delay of 500ms to the AJAX lookup to prevent too much
querying. Perhaps I can drop this value in half?
https://github.com/cuny-academic-commons/bp-event-organiser/blob/master/assets/js/group-select.js#L77


Reply to this email directly or view it on GitHub
#42 (comment).

@r-a-y
Copy link
Member

r-a-y commented May 12, 2015 via email

@boonebgorges
Copy link
Member Author

Yeah, definitely only show the metabox if the user has groups.

Forget my comment here #42 (comment) - I was confusing a delay with a timeout.

The basic issue is this: if a user is a member of 5 groups, it seems like a waste to make them go back to the server to match group names - this process places a load on the server, by reloading WP, and introduces latency due to network effects. IMO it's worth the minor inconvenience to super admins (that they won't be able to add groups of which they're not a member) to make performance better for everyone else. Maybe the super admin issue can be addressed by using AJAX in the Dashboard only, so that if an admin needed to associate an event with groups he's not a member of, it'd have to be done in wp-admin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants