Skip to content

Comments

Only replace system schema if it has been changed#24

Merged
codeliner merged 1 commit intomasterfrom
fix/form_reset_on_focus
Oct 2, 2020
Merged

Only replace system schema if it has been changed#24
codeliner merged 1 commit intomasterfrom
fix/form_reset_on_focus

Conversation

@codeliner
Copy link

In #22 I added a "Automatic Schema Reload" on window focus. It works great, but the forms get reset. Let's say you execute a query, switch to another tab and then back to the cockpit tab. The system schema is fetched again and replaced in the redux store. This causes the query form and result page to rerender, so your query result is gone.

To avoid the issue, I added a check if the system schema really changed and only than replace it. A more complicated solution (but probably better) would be to make a diff and only update the parts in the schema that have changed. I'll create a follow up for that.

Copy link
Collaborator

@martin-schilling martin-schilling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. The only thought that came to my mind is that it might make sense to use memoization here to prevent rerendering. Otherwise, any unrelated changes (that are not schema updates) will have the same effect. Quite hypothetical though 😄

@codeliner codeliner merged commit c34f6b9 into master Oct 2, 2020
@codeliner codeliner deleted the fix/form_reset_on_focus branch October 2, 2020 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants