Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

148
Views
How to use FullCalendar with vuex

I would like to use FullCalendar and keep the events in the vuex store. I have the store set up for the events, I have getters, mutations and an action to call the api and populate the store.

// index.js of the store

export default createStore({
    state () {
      return {
        events: [],
      }
    },
    getters: {
      events: state => state.events,
    },
    mutations: {
      setEvents (state, events) {
          state.events = events
    },
    actions: {
      fetchEvents({ commit }, fetchInfo) {
          const result = // ... API call
          commit('setEvents', result)
      }
    }
  }
})
// calendar.vue

<template>
    <FullCalendar ref="fullCalendar" :options="configOptions"/>
</template>

<script>
// ... omitted imports

export default {
    components: {
    Calendar,
    FullCalendar,
    },
  computed: {
    ...mapGetters(['events']),
    configOptions () {
      return {
        // ... omitted config
        events: this.events,
        datesSet: this.handleViewChange
      }
    },
  },
  methods: {
    ...mapActions({fetchEvents: 'fetchEvents'}),
    handleViewChange(args) {
        // ... omitted handling of dates
        this.fetchEvents(request)
    },
  }
}
</script>

Now I want to fetch new events every time the view changes. I have tried to use datesSet, which is supposed to be called every time the bounding dates of the view change (something that doesn't happen in my code), but unfortunately it's also called when the events in the store change. Meaning datesSet keeps calling the fetch action over and over every times it's finished rendering what just got returned from the fetch.

I have also tried viewClassNames, same result.

Can someone point me in the right direction?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!