diff --git a/components/ProfileView.vue b/components/ProfileView.vue index d450b775..ca7c3228 100644 --- a/components/ProfileView.vue +++ b/components/ProfileView.vue @@ -158,7 +158,9 @@ watch( [isConnected, gridsForDisplay, ownedCollectiblesCount], () => { // select best tab based for initial display - selectBestTab() + if (gridsForDisplay.value.length === 0) { + selectBestTab() + } }, { immediate: true } ) diff --git a/domains/grid/components/GridView.vue b/domains/grid/components/GridView.vue index 8fc98051..a599b6fa 100644 --- a/domains/grid/components/GridView.vue +++ b/domains/grid/components/GridView.vue @@ -19,6 +19,7 @@ const { updateSelectedGrid, initSelectedGridId, getGridById, + gridsForTabs, } = useGrid() const gridContainer = ref(null) const { width } = useElementSize(gridContainer) @@ -93,8 +94,15 @@ const handleResetGrid = async () => { const userGrid = await getUserGrid(address.value) const _grid = buildGrid(userGrid, isMobile.value, canEditGrid.value) - tempGrid.value = cloneObject(_grid) - viewedGrid.value = cloneObject(_grid) + // when user has no grids we re-create empty grids + if (gridsForTabs.value.length === 1) { + viewedGrid.value = cloneObject(EMPTY_GRID) + tempGrid.value = cloneObject(EMPTY_GRID) + } else { + tempGrid.value = cloneObject(_grid) + viewedGrid.value = cloneObject(_grid) + } + gridWidgets.value = getSelectedGridWidgets(cloneObject(_grid)) isSavingGrid.value = false @@ -135,7 +143,7 @@ watch( const updatedViewedGrid = buildGrid( viewedGrid.value, isMobile.value, - canEditGrid.value + canEditGrid.value || gridsForTabs.value.length === 1 ) // if user is in edit mode we use temp grid, otherwise viewed grid @@ -143,7 +151,7 @@ watch( const updatedTempGrid = buildGrid( tempGrid.value, isMobile.value, - canEditGrid.value + canEditGrid.value || gridsForTabs.value.length === 1 ) gridWidgets.value = getSelectedGridWidgets(updatedTempGrid) const changes = compareGrids(updatedViewedGrid, updatedTempGrid) diff --git a/domains/grid/components/GridWidgetAddContent.vue b/domains/grid/components/GridWidgetAddContent.vue index 9f079e4a..910293fd 100644 --- a/domains/grid/components/GridWidgetAddContent.vue +++ b/domains/grid/components/GridWidgetAddContent.vue @@ -1,9 +1,16 @@