Fix not being able to save dataset settings #7903
Merged
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.
Likely due to the frontend changes of #7697, the dataset settings got messed up. The reason is, that the current state of the component does not have the state field
savedDataSourceOnServer
, but it is referenced in a diffiing operation of the datasource schema. Seewebknossos/frontend/javascripts/dashboard/dataset/dataset_settings_view.tsx
Lines 277 to 282 in c50a818
The diffing is used to decide whether the frontend should send an update of the datasource schema to the backend. But in the current version of the master, the diff check always fails as the state field
savedDataSourceOnServer
is always undefined (it does not exist in the state). My fix re-added this field to the state (by renaming the unuseddataSource
tosavedDataSourceOnServer
) and adds a default empty object to the diff, to avoid such an error in any case. Moreover, the type ofsavedDataSourceOnServer
says it can be undefined / null thus the additional optional empty object is needed for the diff.URL of deployed dev instance (used for testing):
Steps to test:
dataset_settings_view.tsx
insubmit
in line 365 set a break point. Do not edit the datasource settings and hit submit. The debugging should show, that now update is set to the server. Alternatively, just record the sent requests to the server. Only when the datasource settings were modified, an update should be sent to the server.Issues:
(Please delete unneeded items, merge only when none are left open)