/**
 * Copyright IBM Corp. 2020, 2026
 *
 * This source code is licensed under the Apache-2.0 license found in the
 * LICENSE file in the root directory of this source tree.
 */

//#region src/components/Datagrid/Datagrid/addons/InlineEdit/handleGridFocus.js
/**
* Copyright IBM Corp. 2022, 2022
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
const handleGridFocus = (state, dispatch) => {
	const { gridActive, previousActiveCellId } = state;
	if (!gridActive) dispatch({
		type: "ADD_GRID_ACTIVE_FOCUS",
		payload: previousActiveCellId || "column-0-row-0"
	});
};
//#endregion
export { handleGridFocus };
