Is it best practice to use a non-persistent PageContext to manage UI state and sync it with persistent UserPreferences?
0
Hi everyone, I'm working on a use case where I want to store user preferences like selected values for fields in the database, so they persist across sessions. Currently, I use a non-persistent entity (PageContext) to manage the selected values and UI state during a session. Now I'm introducing a persistent entity (UserPreferences) to store the same values long-term. This means some attributes (like selected team, language, etc.) exist in both entities. I understand that UserPreferences might eventually include settings that aren't relevant to the UI context, but for now, there's a lot of overlap. My question is: Is it okay to duplicate these fields and associations between PageContext and UserPreferences? Or is there a cleaner pattern for syncing UI state with persistent user settings? Thanks in advance for your insights!