refactor debug for the grid

improve the debug trace for the grid using a dictionary rather than
redraw every views