Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: save extension state #6309

Merged
merged 26 commits into from
Mar 18, 2021
Merged

fix: save extension state #6309

merged 26 commits into from
Mar 18, 2021

Conversation

VanyLaw
Copy link
Contributor

@VanyLaw VanyLaw commented Mar 8, 2021

Description

save extension state

Task Item

close #6086

Screenshots

@coveralls
Copy link

coveralls commented Mar 8, 2021

Coverage Status

Coverage decreased (-0.04%) to 52.849% when pulling c8e6272 on wenyluo/fix into 61da772 on main.

@a-b-r-o-w-n
Copy link
Contributor

Why can't the extension save its own state? I'm concerned that by exposing extension state to the client, the extensions become un-encapsulated. Why not at that point just move the publish extension into the client itself? What is the point of the extension anymore?

@VanyLaw
Copy link
Contributor Author

VanyLaw commented Mar 9, 2021

Why can't the extension save its own state? I'm concerned that by exposing extension state to the client, the extensions become un-encapsulated. Why not at that point just move the publish extension into the client itself? What is the point of the extension anymore?

@a-b-r-o-w-n Your are right, but now the profile adding page[like below] is in client and share with other type of profile. I'm not sure how to keep the form state in client and extension during we moving forward and backward is better? Could you give me some advises? Thanks.

page in client:
image

page in extension:
image

@luhan2017 luhan2017 added the 1.4 label Mar 11, 2021
@VanyLaw
Copy link
Contributor Author

VanyLaw commented Mar 11, 2021

Hi @a-b-r-o-w-n, I use localStorage to save the extension state now. could your help to review the PR? Thanks.

Copy link
Contributor

@a-b-r-o-w-n a-b-r-o-w-n left a comment

Choose a reason for hiding this comment

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

This isn't what we discussed. What we discussed is adding an api in the extension client package called useLocalStorage that returns scoped apis for extensions (and more specifically, bundles) to access local storage.

The extension client will manage scoping those apis correctly. In order to do so we discussed adding a __bundleId to window in order to create a local storage item with the following shape:

{ "composer:extensions": { [__extensionId]: { [__bundleId]: {} } }

@cwhitten
Copy link
Member

Removing from 1.4

@VanyLaw
Copy link
Contributor Author

VanyLaw commented Mar 15, 2021

Hi @a-b-r-o-w-n, I resolved all the comments, could you take a look please?

@luhan2017 luhan2017 merged commit c6e0dd3 into main Mar 18, 2021
@luhan2017 luhan2017 deleted the wenyluo/fix branch March 18, 2021 07:01
@cwhitten cwhitten mentioned this pull request May 20, 2021
lei9444 pushed a commit to lei9444/BotFramework-Composer-1 that referenced this pull request Jun 15, 2021
* save name and target state

* save extension status

* remove annotation

* fix comments

* use localStorage instead of setExtensionState to parent component to save state

* remove setExtensionState, add useLocalStorage

* polish

* update uselocalStorage, use hooks in extension to save state;

* fix comments

* polish

Co-authored-by: Lu Han <[email protected]>
Co-authored-by: Ben Brown <[email protected]>
Co-authored-by: Tony Anziano <[email protected]>
Co-authored-by: Srinaath Ravichandran <[email protected]>
Co-authored-by: Dong Lei <[email protected]>
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.

Back button on Configure Resources does not keep entered information
10 participants