Browse Source

Nc fix: gallery, kanban view cover image load issue if column is hidden (#8290)

* fix(nc-gui): gallery, kanban view cover image load issue if column is hidden

* chore(nc-gui): lint

* fix(nocodb): delete single query cache on update view card cover image

* chore(nc-gui): lint
pull/8297/head
Ramesh Mane 7 months ago committed by GitHub
parent
commit
4128c7f01b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      packages/nc-gui/components/smartsheet/grid/Table.vue
  2. 12
      packages/nc-gui/components/smartsheet/toolbar/FieldsMenu.vue
  3. 9
      packages/nocodb/src/models/GalleryView.ts
  4. 9
      packages/nocodb/src/models/KanbanView.ts

4
packages/nc-gui/components/smartsheet/grid/Table.vue

@ -1973,8 +1973,8 @@ onKeyStroke('ArrowDown', onDown)
v-e="[isAddNewRecordGridMode ? 'c:row:add:grid' : 'c:row:add:form']" v-e="[isAddNewRecordGridMode ? 'c:row:add:grid' : 'c:row:add:form']"
class="nc-grid-add-new-row" class="nc-grid-add-new-row"
type="secondary" type="secondary"
@click="onNewRecordToFormClick()"
:disabled="isPaginationLoading" :disabled="isPaginationLoading"
@click="onNewRecordToFormClick()"
> >
{{ $t('activity.newRecord') }} {{ $t('activity.newRecord') }}
</NcButton> </NcButton>
@ -1983,8 +1983,8 @@ onKeyStroke('ArrowDown', onDown)
v-e="[isAddNewRecordGridMode ? 'c:row:add:grid:toggle' : 'c:row:add:form:toggle']" v-e="[isAddNewRecordGridMode ? 'c:row:add:grid:toggle' : 'c:row:add:form:toggle']"
class="nc-grid-add-new-row" class="nc-grid-add-new-row"
placement="top" placement="top"
@click="isAddNewRecordGridMode ? addEmptyRow() : onNewRecordToFormClick()"
:disabled="isPaginationLoading" :disabled="isPaginationLoading"
@click="isAddNewRecordGridMode ? addEmptyRow() : onNewRecordToFormClick()"
> >
<div data-testid="nc-pagination-add-record" class="flex items-center px-2 text-gray-600 hover:text-black"> <div data-testid="nc-pagination-add-record" class="flex items-center px-2 text-gray-600 hover:text-black">
<span> <span>

12
packages/nc-gui/components/smartsheet/toolbar/FieldsMenu.vue

@ -180,7 +180,15 @@ const updateCoverImage = async (val?: string | null) => {
}) })
;(activeView.value.view as CalendarType).fk_cover_image_col_id = val ;(activeView.value.view as CalendarType).fk_cover_image_col_id = val
} }
reloadViewMetaHook?.trigger()
await reloadViewMetaHook?.trigger()
// Load data only if the view column is hidden to fetch cover image column data in records.
if (val && !fields.value?.find((f) => f.fk_column_id === val)?.show) {
await reloadViewDataHook?.trigger({
shouldShowLoading: false,
})
}
} }
} }
@ -356,7 +364,7 @@ useMenuCloseOnEsc(open)
@click.stop @click.stop
> >
<div <div
v-if="!filterQuery && !isPublic && (activeView?.type === ViewTypes.GALLERY || activeView?.type === ViewTypes.KANBAN)" v-if="!isPublic && (activeView?.type === ViewTypes.GALLERY || activeView?.type === ViewTypes.KANBAN)"
class="flex flex-col gap-y-2 px-2 mb-6" class="flex flex-col gap-y-2 px-2 mb-6"
> >
<div class="flex text-sm select-none">Select cover image field</div> <div class="flex text-sm select-none">Select cover image field</div>

9
packages/nocodb/src/models/GalleryView.ts

@ -117,6 +117,15 @@ export default class GalleryView implements GalleryType {
prepareForResponse(updateObj), prepareForResponse(updateObj),
); );
const view = await View.get(galleryId);
// on update, delete any optimised single query cache
await View.clearSingleQueryCache(
view.fk_model_id,
[{ id: galleryId }],
ncMeta,
);
return res; return res;
} }
} }

9
packages/nocodb/src/models/KanbanView.ts

@ -125,6 +125,15 @@ export default class KanbanView implements KanbanType {
prepareForResponse(updateObj), prepareForResponse(updateObj),
); );
const view = await View.get(kanbanId);
// on update, delete any optimised single query cache
await View.clearSingleQueryCache(
view.fk_model_id,
[{ id: kanbanId }],
ncMeta,
);
return res; return res;
} }
} }

Loading…
Cancel
Save