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: location select Content component #1668

Merged
merged 10 commits into from
Dec 5, 2019
Merged

fix: location select Content component #1668

merged 10 commits into from
Dec 5, 2019

Conversation

liweitian
Copy link
Contributor

@liweitian liweitian commented Nov 27, 2019

Description

Refactor the locationSelectContent part to make it more pure.

The overall idea/code flow becomes. Every time we changed the location(the last accessed path), it will save to data.json, then the storages in stores(global state) will be changed too. This will trigger updating the focuedStorageFolder.

Task Item

closes #1603
closes #1291

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code refactor (non-breaking change which improve code quality, clean up, add tests, etc)

Checklist

  • I have added tests that prove my fix is effective or that my feature works
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have functionally tested my change

Screenshots

1111

@liweitian liweitian changed the base branch from stable to master November 27, 2019 09:26
@liweitian liweitian changed the title refactor: location select Content component [WIP]refactor: location select Content component Nov 27, 2019
@liweitian liweitian changed the title [WIP]refactor: location select Content component refactor: location select Content component Nov 27, 2019
@github-actions
Copy link

Coverage Status

Coverage decreased (-0.08%) to 39.939% when pulling ad4c981 on liweitian/refactor into f492bef on master.

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.

Left a few comments. My main request is that DefineConversation/index.js be converted to typescript.

}) &&
i < MAXTRYTIMES
);
return defaultName;
Copy link
Contributor

Choose a reason for hiding this comment

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

So if MAXTRYTIMES is reached without finding a unique name, the default name will be the last computed name and invalid right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Previously, it will be an endless loop if we cannot find an unique name(probably due to a bug). According to @compulim, we should throw an error when the MAXTIMES reached. But I feel even if this do happen, we should not decrease user's experience. This is a small feature. So I keep the code this way just like what you said. If the code generate a duplicated name, an error message will show.

if (storages && storages.length > 0) {
const storageId = storages[currentStorageIndex.current].id;
const path = storages[currentStorageIndex.current].path;
const formatedPath = Path.normalize(path);
Copy link
Contributor

Choose a reason for hiding this comment

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

This was marked resolved, but was not addressed.

Composer/packages/server/src/services/storage.ts Outdated Show resolved Hide resolved
@liweitian liweitian changed the title refactor: location select Content component [WIP]refactor: location select Content component Dec 3, 2019
@liweitian liweitian changed the title [WIP]refactor: location select Content component refactor: location select Content component Dec 4, 2019
@cwhitten cwhitten changed the title refactor: location select Content component fix: location select Content component Dec 4, 2019
@cwhitten cwhitten merged commit f74ce9c into master Dec 5, 2019
@cwhitten cwhitten deleted the liweitian/refactor branch December 5, 2019 00:15
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.

4 participants