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

autoresult data loading problem when route change #12

Closed
DC-507 opened this issue May 12, 2022 · 1 comment
Closed

autoresult data loading problem when route change #12

DC-507 opened this issue May 12, 2022 · 1 comment

Comments

@DC-507
Copy link

DC-507 commented May 12, 2022

Environment: Meteor 2.7.2; VUE 3.2.29; vuejs:vue3; vuex 4.0.2; vue-router:4.0.12

When I use router change different router-view, if they use same collection subscribe() and autoResult(). autoResult() at the second router-view still loading the result subcribe in the first one. and the second router-view's subscribe will render the veiw until waiting this process finished. the result looks like being pollution by pre-router-view's result. if the result is big then hundreds records, it will take a longtime.

I don't known, it is something i missed?

code in pre-route-view:

subscribe("getAllofSF");
const fullSFQ_RS = autoResult(() => SurveyForms.find({}));

    const totalUQ = computed(() => {
      var tmpParts = new Map();
      if (totalUQ_RS.value.length > 0 && fullSFQ_RS.value.length > 0) {

code in second-route-view:

subscribe("getTimesofSF", ss_sf_sn);
const currentSFQ_RS = autoResult(() => SurveyForms.find({}));

    var totalSF = ref({});
    totalSF = computed(() => {
      var tmpParts = new Map();
      var totalSFList = [];
      if (currentSFQ_RS.value.length > 0) {
@DC-507
Copy link
Author

DC-507 commented May 12, 2022

use subscribe return object { ready } to fix it.

autoresult can interrupt

const is_SFQ_Ready = subscribe("getTimesofSF", ss_sf_sn);
var totalSF = ref({});
totalSF = computed(() => {
  var tmpParts = new Map();
  var totalSFList = [];
  if (is_SFQ_Ready.ready.value) {
.........

@DC-507 DC-507 closed this as completed May 12, 2022
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

1 participant