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

Options API: functions in meteor object cannot access other properties #80

Open
rickynaps opened this issue Jun 13, 2023 · 1 comment
Open

Comments

@rickynaps
Copy link

<script>
  export default {
    data() {
      return {
        selectedThreadId: 'test',
      };
    },
    computed: {
      testComputed() {
        return 'testComputed';
      },
    },
    meteor: {
      $subscribe: {
        threads: [],
      },
      meteorTestComputed() {
        // returns undefined
        return this.testComputed;
      },
      testSubReady() {
        // this.$subReady.threads == undefined
        if (this.$subReady.threads) {
          console.log('test If');
        }
      },
      threads() {
        //  Works as expected.
        return Threads.find(
          {},
          {
            sort: { date: -1 },
          }
        );
      },
      threadsTest() {
        // Returns undefined
        return this.threads;
      },
      selectedThread() {
        // Doesn't work as expected.
        const test = this.selectedThreadId;
        // test == undefined
        // The same happens with properties in computed and meteor sections.
        return Threads.findOne(this.selectedThreadId);
      },
    },
  };
</script>

<!-- 
computed
can access meteor properties
cursor is not reactive

meteor
cursor is reactive
cannot access computed, meteor or data properties
can access this correctly -->
@xolott
Copy link

xolott commented Aug 17, 2023

Same here, with:

  • vue 3.3.4
  • meteor 2.12

We can't access data or computed properties inside the meteor block.

I had to change the component to composition API

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