Skip to content

Releases: feathersjs-ecosystem/feathers-vuex

🎁 Patch with partial data

19 Mar 20:19
Compare
Choose a tag to compare

As of version 3.9.0, you can provide an object as params.data, and Feathers-Vuex will use params.data as the patch data. This change was made to the service-module, itself, so it will work for patch across all of feathers-vuex. Here's an example of patching with partial data:

import { models } from 'feathers-vuex'
const { Todo } = models.api

const todo = new Todo({ description: 'Do Something', isComplete: false })

todo.patch({ data: { isComplete: true } })

// also works for patching with instance.save
todo.save({ data: { isComplete: true } })

🐜Improve Docs & FeathersVuexPaginate

15 Mar 12:15
Compare
Choose a tag to compare

Many GitHub issues were closed related to the documentation.

The FeathersVuexPaginate component was upgraded to automatically paginate to the last page when on a higher page and the total pageCount drops below the currentPage (as happens when you filter/search the results). For example, if you're looking at page 40 and you perform a search which limits the total results to three pages, the page will automatically switch to page 3.

🐜Fix FeathersVuexPagionation off-by-one error

15 Mar 12:12
Compare
Choose a tag to compare

This release fixes a bug where the canNext computed attribute in the FeathersVuexPagination component was off by one.

🎁 New FeathersVuexPagination Renderless Component

14 Mar 05:37
Compare
Choose a tag to compare

This release includes an awesome new FeathersVuexPagination component which simplifies implementing Server-Side Pagination solutions. It's a Renderless component, so bring your own UI to the #default slot.

Read the documentation

Example:

<template>
  <div>
    <FeathersVuexPagination v-model="pagination" :latest-query="latestQuery">
      <template #default="{ currentPage, pageCount, toStart, toEnd, toPage, next, prev, canNext, canPrev }">
        <PaginationUi
          :current-page="currentPage"
          :page-count="pageCount"
          :can-prev="canPrev"
          :can-next="canNext"
          @to-start="toStart"
          @to-end="toEnd"
          @to-page="toPage"
          @next="next"
          @prev="prev"
        />
      </template>
    </FeathersVuexPagination>

    <!-- Results -->
    <div>
      <div v-for="item in items" :key="item._id">
        {{ item }}
      </div>
    </div>
  </div>
</template>

<script>
import { ref, computed, watch } from '@vue/composition-api'
import { models, useFind, FeathersVuexPagination } from 'feathers-vuex'
import PaginationUi from './PaginationUi.vue'

export default {
  name: 'PaginationExample',
  components: {
    FeathersVuexPagination,
    PaginationUi
  },
  setup(props, context) {
    const { Listing } = models.api

    const pagination = ref({
      $limit: 20,
      $skip: 0
    })

    const params = computed(() => {
      const query = {}
      Object.assign(query, pagination.value)

      return { query, qid: 'listingsPage', paginate: true }
    })

    const { items, latestQuery } = useFind({ model: Listing, params: params })

    return { items, pagination, latestQuery }
  }
}
</script>

🎁📄🐜 Cleaner Docs, removeTemps, useFind

12 Mar 20:40
Compare
Choose a tag to compare

This release includes the following fixes and improvements:

  • 📄 Docs: @fratzinger generously made a huge update to many places in the documentation. This included clarifications, updates, and removal of straggling content left over from 2.0.
  • 🎁 Improvement: The removeTemps mutation has been updated to allow removing temporary records that have not yet been created in the API. Its original purpose was to assist in migrating temporary records into the keyedById service store after successfully saving the temp record to the api server. Outside of the original context, the mutation finally works as you would expect. ;). Thanks @fratzinger!
  • 🐜 Fixed: The useFind server-side pagination has been fixed thanks to a bug caught by @agte.

Many, many thanks to @fratzinger and @agte for their assistance and contributions for this release!

Oops

12 Mar 20:30
Compare
Choose a tag to compare

This is not the release you're looking for.

Check out v3.7.0

🐜 Bug fixes & Docs Updates

12 Mar 20:23
Compare
Choose a tag to compare

This patch release fixes some bugs in the docs and the modules.

  • A straggling debugger statement was removed from the FeathersVuexInputWrapper.
  • The Nuxt example docs have been updated to fix the redirect location.
  • In the useFind utility (Composition API) a guard against checking object attributes of null params has been put into place.

Many, many thanks to @emmanuelgeoffray, @anli-xsigns, and @andrewharvey for their contributions to this release!

🐞 Fix a bug with `Model.getFromStore` when also passing params

12 Feb 19:14
Compare
Choose a tag to compare

This release fixes a bug with the Model.getFromStore method when multiple arguments were provided, as shown here:

import { models } from 'feathers-vuex'
const { Todo } = models.api

const $populateParams = { name: 'org' }
Todo.getFromStore(1, { $populateParams })

When doing a query with the above, the arguments would be passed as an array to the get getter, which would cause it to return nothing. This update makes sure you can use the above syntax and still get a result back from the store.

🎁 New shorthand for clone and commit!

12 Feb 05:00
Compare
Choose a tag to compare

This version brings a new shorthand syntax for the Clone and Commit pattern. You can now pass an object to an instance's clone() method, and that value will be merged into the clone right away.

The Old Way

Previously, this was the only way to clone and commit.

const todo = Todo.getFromStore(1)

const clone = instance.clone()
Object.assign(clone, { description: 'boilerplate code sucks' })
clone.commit()
todo.save()

It's not the prettiest syntax. It was designed as an elegant (in the eye of the beholder;) way to get around Vuex limitations / best practices.

The New Way

Here is the new syntax, thanks to @mrfrase3's contribution:

const todo = Todo.getFromStore(1)

todo.clone({ description: 'all in one line' }).save()

The above example will update the local instance after the call to save() returns from the API server. If you want to do eager updating, so the UI updates BEFORE the request is made, just sneak a .commit() in before save:

const todo = Todo.getFromStore(1)

todo.clone({ description: 'all in one line' }).commit().save()

The original method of clone and commit isn't going away. We just have a shorthand way of accomplishing the same thing, now.

Prevent `stories/*.stories.js` from publishing to npm

31 Jan 21:55
Compare
Choose a tag to compare

I think this might be the final effort to get rid of the damn stories on npm. ;)