From 2aa04323ffea1fe06b0ec315f697019cd75a878c Mon Sep 17 00:00:00 2001 From: chenos Date: Thu, 25 Mar 2021 16:54:11 +0800 Subject: [PATCH] fix: auto get filter fields --- packages/plugin-pages/src/actions/views_v2:getInfo.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/plugin-pages/src/actions/views_v2:getInfo.ts b/packages/plugin-pages/src/actions/views_v2:getInfo.ts index dc72f01796..ecf3ca4126 100644 --- a/packages/plugin-pages/src/actions/views_v2:getInfo.ts +++ b/packages/plugin-pages/src/actions/views_v2:getInfo.ts @@ -383,6 +383,15 @@ export const getInfo = async (ctx: actions.Context, next) => { }); data.groupField = groupField; } + + data.actions = data.actions.map(action => { + if (action.type === 'filter') { + if (!action.fields) { + action.fields = data.fields.filter(({filterable}) => filterable); + } + } + return action; + }); ctx.body = data; await next();