fix(state_mgr): incorrect state init
This commit is contained in:
parent
cf3332a22f
commit
101d47b2f7
5 changed files with 40 additions and 35 deletions
|
@ -478,23 +478,26 @@ export class Browser extends React.Component<Props, State, {}> {
|
|||
});
|
||||
|
||||
const sharingList = this.props.sharings.map((dirPath: string) => {
|
||||
<div key={dirPath} className="flex-list-container">
|
||||
<span className="flex-list-item-l">{dirPath}</span>
|
||||
<span className="flex-list-item-r">
|
||||
<button
|
||||
onClick={() => {
|
||||
this.deleteSharing(dirPath);
|
||||
}}
|
||||
className="grey1-bg white-font"
|
||||
>
|
||||
Delete
|
||||
</button>
|
||||
</span>
|
||||
</div>;
|
||||
return (
|
||||
<div key={dirPath} className="flex-list-container">
|
||||
<span className="flex-list-item-l">
|
||||
<span className="dot yellow3-bg"></span>
|
||||
<span className="bold">{dirPath}</span>
|
||||
</span>
|
||||
<span className="flex-list-item-r padding-r-m">
|
||||
<button
|
||||
onClick={() => {
|
||||
this.deleteSharing(dirPath);
|
||||
}}
|
||||
className="grey1-bg white-font"
|
||||
>
|
||||
Delete
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
console.log("browser", this.props.sharings, this.props.isSharing);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div id="op-bar" className="op-bar">
|
||||
|
@ -535,7 +538,7 @@ export class Browser extends React.Component<Props, State, {}> {
|
|||
<div className="flex-list-container bold">
|
||||
<span className="flex-list-item-l">
|
||||
<span className="dot black-bg"></span>
|
||||
<span>Uploading Files</span>
|
||||
<span>Sharing Folders</span>
|
||||
</span>
|
||||
<span className="flex-list-item-r padding-r-m"></span>
|
||||
</div>
|
||||
|
|
|
@ -179,7 +179,16 @@ export class Updater {
|
|||
...prevState,
|
||||
panel: {
|
||||
...prevState.panel,
|
||||
browser: { ...this.props }, // TODO: use spread
|
||||
browser: {
|
||||
dirPath: this.props.dirPath,
|
||||
isSharing: this.props.isSharing,
|
||||
items: this.props.items,
|
||||
uploadings: this.props.uploadings,
|
||||
sharings: this.props.sharings,
|
||||
uploadFiles: this.props.uploadFiles,
|
||||
uploadValue: this.props.uploadValue,
|
||||
isVertical: this.props.isVertical,
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
|
|
|
@ -43,7 +43,6 @@ export class RootFrame extends React.Component<Props, State, {}> {
|
|||
|
||||
render() {
|
||||
const update = this.props.update;
|
||||
console.log("rootframe", this.props.browser.isSharing);
|
||||
|
||||
return (
|
||||
<div className="theme-white desktop">
|
||||
|
|
|
@ -38,44 +38,38 @@ export class StateMgr extends React.Component<Props, State, {}> {
|
|||
return BrowserUpdater().refreshUploadings();
|
||||
})
|
||||
.then((_: boolean) => {
|
||||
BrowserUpdater().initUploads();
|
||||
return BrowserUpdater().initUploads();
|
||||
})
|
||||
.then(() => {
|
||||
BrowserUpdater().setSharing(BrowserUpdater().props.dirPath.join("/"));
|
||||
return BrowserUpdater().setSharing(
|
||||
BrowserUpdater().props.dirPath.join("/")
|
||||
);
|
||||
})
|
||||
.then(() => {
|
||||
BrowserUpdater().listSharings();
|
||||
return BrowserUpdater().listSharings();
|
||||
})
|
||||
.then(() => {
|
||||
this.update(BrowserUpdater().setBrowser);
|
||||
console.log("0", this.state, BrowserUpdater().props);
|
||||
})
|
||||
.then(() => {
|
||||
PanesUpdater.self();
|
||||
console.log("1", this.state);
|
||||
return PanesUpdater.self();
|
||||
})
|
||||
.then(() => {
|
||||
PanesUpdater.listRoles();
|
||||
console.log("2", this.state);
|
||||
return PanesUpdater.listRoles();
|
||||
})
|
||||
.then(() => {
|
||||
PanesUpdater.listUsers();
|
||||
console.log("3", this.state);
|
||||
return PanesUpdater.listUsers();
|
||||
})
|
||||
.then(() => {
|
||||
this.update(PanesUpdater.updateState);
|
||||
console.log("final", this.state);
|
||||
});
|
||||
};
|
||||
|
||||
update = (apply: (prevState: ICoreState) => ICoreState): void => {
|
||||
this.setState(apply(this.state));
|
||||
console.log("core", this.state);
|
||||
};
|
||||
|
||||
render() {
|
||||
console.log("state_mgr", this.state.panel.browser.isSharing);
|
||||
|
||||
return (
|
||||
<RootFrame
|
||||
authPane={this.state.panel.authPane}
|
||||
|
|
|
@ -20,9 +20,9 @@ const (
|
|||
RoleListNs = "roleList"
|
||||
InitTimeKey = "initTime"
|
||||
|
||||
defaultSpaceLimit = 1024 // 1GB
|
||||
defaultUploadSpeedLimit = 50 * 1024 * 1024 // 50MB
|
||||
defaultDownloadSpeedLimit = 50 * 1024 * 1024 // 50MB
|
||||
defaultSpaceLimit = 1024 * 1024 * 1024 // 1GB
|
||||
defaultUploadSpeedLimit = 50 * 1024 * 1024 // 50MB
|
||||
defaultDownloadSpeedLimit = 50 * 1024 * 1024 // 50MB
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue