Nested v-for loop on firestore data reactively duplicates deepest layer on changes

I have nested data in firestore, and I want to represent this as a nested list. However, when I change a value in the firestore database, the second level of values are not updated.

On load it looks correct: enter image description here

But when I change “Temperature1” to “Temperature”, it updates like this: enter image description here

If I reload the page it all loogks correct again: enter image description here

If I change the top level name, e.g. Cactus, it behaves as expected (the name gets updated reactively).

How can I get the second level strings to also be simply reactively updated without duplication??

This is my data structure in firestore: (id are auto generated ids)

-users (collection) |-id0 (doc)  |-name: "Niels"  |-tiles (collection)   |-id1 (doc)   | |-name: "Monstera Deliciosa"   | |-services (collection)   |   |-id2 (doc)   |   | |-name: "Temperature"   |   |-id3 (doc)   |     |-name: "Relative-humidity"   |-id4 (doc)     |-name: "Cactus"     |-services (collection)       |-id2 (doc)         |-name: "Soil moisture" 

Here are excerpts of my code:

My Vue component (which is the main view): Dashboard.vue

<template>     <div id="dashboard">         <ul v-for="tile in tiles">             <li>{{ }}</li>             <ul v-for="service in">                 <li>{{}}</li>             </ul>         </ul>     </div> </template>  <script>     import { mapState } from 'vuex'     const fb = require('../firebaseConfig.js')      export default {         computed: {             ...mapState(['tiles'])         }     } </script> 

And my store.js file:

import Vue from 'vue' import Vuex from 'vuex' const fb = require('./firebaseConfig.js')  Vue.use(Vuex)  // handle page reload fb.auth.onAuthStateChanged(user => {     if (user) {         // realtime updates from tiles         fb.usersCollection.doc(user.uid).collection('tiles').orderBy('name', 'asc').onSnapshot(tilesSnapshot => {             let tilesArray = []              tilesSnapshot.forEach(tileDoc => {                 let tile =        =                 // console.log("Tile name:",                  let servicesArray = []                 tileDoc.ref.collection('services').onSnapshot(servicesSnapshot => {                     servicesSnapshot.forEach(serviceDoc => {                         let service =                =                         servicesArray.push(service)                     })                 })        = servicesArray                 tilesArray.push(tile)             })             store.commit('setTiles', tilesArray)         })     } })  export const store = new Vuex.Store({     state: {         tiles: []     },     mutations: {         setTiles(state, val) {             if (val) {                 state.tiles = val             } else {                 state.tiles = []             }         }     } }) 

Link Pyramids For SEO- Best 3 Layer Blog Theme Backlinks Package for $19

Blog Networking Is The Best SEO Link Building Procedure and 3 Layer Link Pyramids Of WEB2.0 Blogs Will Finish Your SEO Project. I’m Introducing Here One Of The Most Powerful Packages At Lowest Price In Link Pyramids Category. Blog Them Link Pyramids Contains Of 3 Tiers Of WEB2.0 Blogs Backlinks Powered By 2 Layer Of Social Networds And Article Directories. More About This Service: Tier 1: Contains 50 WEB2.0 Blogs PR2-8 Plus 20 Social Network Posts All Niche Relevant. Tiere 2: Contains 50 WEB2.0 Profiles Plus 50 WEB2.0 Blogs. Tiere 3: Contains 500 Article Directory PR 2-8 Plus 50 Social Network Posts + 30 Social Bookmarking. What Keyword Difficulty Is This Service Suitable: Will Rank All Keyword With hardness Up to 35 based On Keyword Finder Ranking Algorithm.

by: rayanmehr
Created: —
Category: Link Pyramids
Viewed: 237

Utils, Service class and Persistence Layer

I have a method in API handler which does API validation, performs business logic and then makes a call to db. Is it a good idea to move the business logic to utility class or service class?

IMO the business logic should be moved to service as utility class are supposed to have methods which can be shared across applications. If I move the business logic to utility class then it will cause a dependency between accessor and utility which will also make it difficult to unit test.

Pls let me know if my reasoning above is correct.

Service Layer with multiple validation and other functions

I am currently developing a REST Api using Slim Framework with a Layered Architecture:


My problem is the save() function on one of my services contains a collection of complex functions which clearly violates the Separation of Responsibility Principle so I grouped the functions based on their “responsibilities”. Here are some of it:

  • Data Validation
  • Record Locking
  • Edit History Logging
  • Destination Delegation

These functions are not always executed. It executes depending on the data passed onto the service and some of the functions blocks the saving if a business rule is violated. Currently,I am planning to solve it using the Chain-of-Responsibility Pattern

class PropertyController {     public function saveAction($  request, $  response, $  args)     {         $  data = $  req->getParsedBody();          $  dataValidation = new DataValidation();         $  recordLocking = new RecordLocking();         $  editHistoryLogging = new EditHistoryLogging();         $  destinationDelegation = new DestinationDelegation();          $  dataValidation->next($  recordLocking);         $  recordLocking->next($  editHistoryLogging);         $  editHistoryLogging->next($  destinationDelegation);          $  propertyService = new PropertyService(new PropertyEloquentRepository());         $  result = $  propertyService->save($  data, $  dataValidation);          return $  response->withStatus(200)             ->withHeader('Content-Type','application/json')             ->write(json_encode($  result));     } } 

Is this implementation fine and is considered a good practice?

How to properly decouple the service layer from the user interface layer, if the service layer needs to interact with the user?

In my program, I have a long-running function from which I would like to interact with the user for various reasons:

  1. Giving status updates (“Downloading file /foo/bar.png)
  2. Displaying warnings (“File upload failed; will retry later”)
  3. Asking for input (“Please enter your google drive password”)

The problem is, of course, that this function doesn’t know how it should interact with the user. For example, it would be nonsensical to display messages on stdout in a GUI program.

In case of errors, the solution is obvious – just throw an exception that’ll be caught in the user interface layer. Errors are easy because the service layer’s job is done as soon as the exception is thrown. But what about things like warnings and input? How do I bridge the gap between the service layer and the user?