Skip to content

Clear up how we pass around view state#2597

Merged
robertbrignull merged 2 commits intomainfrom
robertbrignull/data-view-state
Jul 12, 2023
Merged

Clear up how we pass around view state#2597
robertbrignull merged 2 commits intomainfrom
robertbrignull/data-view-state

Conversation

@robertbrignull
Copy link
Copy Markdown
Contributor

I realised we were passing in both ViewState and Mode to some components. This is a mistake I made earlier and didn't realise the view state was already available.

I also take the opportunity to simplify the types and avoiding passing a possibly-undefined view state around as much as possible. This shouldn't ever be undefined in practice because the first thing we do once the view is loaded is to send a setDataExtensionEditorViewState message. The fact that we have to do this is a drawback of the webview model where we have to send initialisation data only after the view is loaded. I think we can treat the brief window where the view state is undefined as a "loading" phase and display a message. This way for the rest of the code we are sure that the variable is defined. In practice this loading message is invisible and I can't spot it when the view is opened.

Checklist

  • CHANGELOG.md has been updated to incorporate all user visible changes made by this pull request.
  • Issues have been created for any UI or other user-facing changes made by this pull request.
  • [Maintainers only] If this pull request makes user-facing changes that require documentation changes, open a corresponding docs pull request in the github/codeql repo and add the ready-for-doc-review label there.

Copy link
Copy Markdown
Contributor

@charisk charisk left a comment

Choose a reason for hiding this comment

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

This is great! Thank you for tidying things up and for the nice clear commits.

@robertbrignull robertbrignull merged commit 28c6ab3 into main Jul 12, 2023
@robertbrignull robertbrignull deleted the robertbrignull/data-view-state branch July 12, 2023 09:04
RubyRusul

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants