TL;DR
When switching from Thing A with a filled field to Thing B with an empty field Rich Text Input “caches” the value of the Thing A’s field.
Issue description
I have a Repeating Group with a list of users and a separate group to show selected user details. Some text fields within my User
data type are optional (for example, info
or notes
). These optional fields are displayed (and can be edited) in Rich Text Input elements.
So today I was editing User A with filled info
field and right after that (without page reload) I made some changes to User B with empty info
field. After saving User B data changes I’ve noticed that his empty info
field was populate with User A’s info
value.
After checking my DB I was “happy” to find out that there were a lot of users with duplicated info
values, so I had to clean them up…
Investigation
While debugging I’ve discovered that despite the fact that Rich Text Input was visually empty (initial content = empty) - the value it kept was not empty:
After spending almost the whole day on struggling with this issue I’ve found out that this issue occurs when three conditions are met simultaneously:
- Rich Text Element is wrapped into a parent Group
- Rich Text Element references parent Group in the data source (
Parent Group's thing
) - Rich Text Element should be visible on the page (if it’s hidden - you’ll not be able to reproduce the bug)
Workaround
During test performing I’ve found out that as soon as your Rich Text Element doesn’t reference it’s Parent Group's thing
- you are safe. So you are free to reference a custom state or some VAR group (group that is used just to store variables).
P.S.
I’ve created a quick demo app where you can check this issue. To reproduce the issue you need to follow the sequence of user selecting:
User test2@test.com has empty info
field.
Use Inspect function of the debugger to check Rich Text Elements values.
Demo app setup
-
Database:
- default
User
data type is enriched with an additional text fieldinfo
- there are 3 users in the DB, one of them has empty
info
field
- default
-
Elements:
- Rich Text Input #1:
- wrapped into a Group A (group’s type of content =
User
) - initial content =
Parent's group's User's info
- wrapped into a Group A (group’s type of content =
- Rich Text Input #2:
- wrapped into a Group B (group’s type of content is not determined as by default)
- initial content =
Group VAR's User's info
(so it references an external group, not the parent)
- Group VAR:
- group’s type of content =
User
- data source =
empty
- group’s type of content =
- Repeating group Users: used for selecting user to be displayed in Rich Text Inputs
- Rich Text Input #1:
-
Workflow: single WF that triggers on user’s email click (in RG User), consists of 2 actions:
- Display data:
current cell's user
in Group A - Display data:
current cell's user
in Group VAR
- Display data: