fix: Include element props
in SQLAlchemyDataLayer query for elements
#1949
+9
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Fixes an issue arising with
SQLAlchemyDataLayer
in which a custom element's state would not be properly reloaded after resuming a chat thread due to a null value for the element'sprops
. #1799 documents the issue in more detail, including a fix.Problem
In
sql_alchemy.py
, the SQL query contained inelements_query
is missing theprops
. Since this is missing, any reloaded custom element will have an empty value forprops
thereby ignoring its latest state.Also, there was an error on insertion of new elements into the database in an identical fashion to #1794 which fixes the same error in the default Postgres data layer. This PR includes the same fix for the SQLAlchemyDataLayer which also blocked a successful element refresh workflow.
Steps to Reproduce
Solution and Changes
Add the
props
field to the query and useprops=element.get("props", "{}")
instead ofprops=json.loads(element.get("props", "{}"))
Testing
pytest
frombackend/
with no failures or errors and all tests finishing.