nuxt icon indicating copy to clipboard operation
nuxt copied to clipboard

Add support of watchQuery for nested objects

Open Koc opened this issue 4 years ago • 0 comments

What problem does this feature solve?

I am building grid for orders list with some filters. Next code used for parse/stringify query:

    router: {
        parseQuery(query) {
            const qs = require('qs');
            const options = {allowDots: true, comma: true};

            return qs.parse(query, options);
        },
        stringifyQuery(query) {
            const qs = require('qs');
            const options = {allowDots: true, arrayFormat: 'comma', skipNulls: true};

            return Object.keys(query).length > 0 ? ('?' + qs.stringify(query, options)) : '';
        },
    },

Each filter updates coresponding filter property, for example for filter by status next url generates: http://admin.test:3000/orders-list?filter.status=done . And for now there is no support define watchQuery: ['page', 'filter.status'] or watchQuery: ['page', 'filter'] to get asyncData executed when filter.status updated.

watchQuery: true could be used as workaround, but seems to be bad idea in terms of performance.

This feature request is available on Nuxt community (#c9406)

Koc avatar Jun 24 '19 19:06 Koc