Skip to content

Commit f8c9861

Browse files
Prevent reference sharing between entry and data (#1571)
* Prevent reference sharing between entry and data Change detection doesn't work when updating the self._data also updates self._entry.data because the reference to the cpid key is the same list. This prevents the data being persisted to disk. * cleanup testing code * Whitespace cleanup * Whitespace cleanup
1 parent cb3477c commit f8c9861

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

custom_components/ocpp/config_flow.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Adds config flow for ocpp."""
22

33
from typing import Any
4+
from copy import deepcopy
45
from homeassistant.config_entries import (
56
ConfigEntry,
67
ConfigFlow,
@@ -140,6 +141,7 @@ async def async_step_integration_discovery(
140141
self._entry = discovery_info["entry"]
141142
self._cp_id = discovery_info["cp_id"]
142143
self._data = {**self._entry.data}
144+
self._data = deepcopy(self._data)
143145

144146
await self.async_set_unique_id(self._cp_id)
145147
# Abort the flow if a config entry with the same unique ID exists

0 commit comments

Comments
 (0)