williaster commented on a change in pull request #4791: apply new Dashboard builder to dashboard URL: https://github.com/apache/incubator-superset/pull/4791#discussion_r180881658
########## File path: superset/assets/javascripts/dashboard/reducers/dashboard.js ########## @@ -0,0 +1,123 @@ +import d3 from 'd3'; + +import * as actions from '../actions/dashboard'; +import { alterInArr, addToArr, removeFromArr } from '../../reduxUtils'; + +export default function dashboard(state = {}, action) { + const actionHandlers = { + [actions.UPDATE_DASHBOARD_TITLE]() { + const newDashboard = { ...state.dashboard, dashboard_title: action.title }; + return { ...state, dashboard: newDashboard }; + }, + [actions.ADD_SLICE]() { + const updatedSliceIds = new Set(state.dashboard.sliceIds); + updatedSliceIds.add(action.slice.slice_id); + return { + ...state, + dashboard: { ...state.dashboard, sliceIds: updatedSliceIds } + }; + }, + // [actions.UPDATE_DASHBOARD_LAYOUT]() { + // const newDashboard = { ...state.dashboard, layout: action.layout }; + // return { ...state, dashboard: newDashboard }; + // }, + [actions.REMOVE_SLICE]() { + const sliceId = action.sliceId; + const updatedSliceIds = new Set(state.dashboard.sliceIds); + updatedSliceIds.delete(sliceId); + + const key = String(sliceId); Review comment: why do you need to convert this to a string? all object keys are strings ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services