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

IMPROVE: improve performance by avoiding redundant double fetch when … #52

Merged
merged 1 commit into from Aug 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 25 additions & 0 deletions assets/javascripts/discourse/initializers/location-edits.js.es6
Expand Up @@ -10,6 +10,7 @@ import { withPluginApi } from 'discourse/lib/plugin-api';
import { geoLocationFormat } from '../lib/location-utilities';
import { scheduleOnce } from "@ember/runloop";
import I18n from "I18n";
import { longDate } from "discourse/lib/formatter";

export default {
name: 'location-edits',
Expand Down Expand Up @@ -37,6 +38,30 @@ export default {
);
}
});
api.modifyClass("controller:users", {
loadUsers(params) {

if (params.period === "location") {
return;
}
this.set("isLoading", true);

this.store
.find("directoryItem", params)
.then((model) => {
const lastUpdatedAt = model.get("resultSetMeta.last_updated_at");
this.setProperties({
model,
lastUpdatedAt: lastUpdatedAt ? longDate(lastUpdatedAt) : null,
period: params.period,
nameInput: params.name,
});
})
.finally(() => {
this.set("isLoading", false);
});
},
});
});

TopicStatus.reopen({
Expand Down
Expand Up @@ -25,7 +25,6 @@ export default {
},

handleMapTransition(transition) {
debugger;
const intent = transition.intent;
const name = transition.targetName
const queryParams = intent.router.activeTransition.to.queryParams
Expand Down