mirror of
https://github.com/filecoin-project/slate.git
synced 2024-12-25 10:05:02 +03:00
fixes public slates for new refresh scheme
This commit is contained in:
parent
059a16845c
commit
58d94d8f6a
@ -11,20 +11,32 @@ export default class ScenePublicSlate extends React.Component {
|
|||||||
slate: null,
|
slate: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount = () => {
|
componentDidMount = async () => {
|
||||||
this.renderSlate();
|
await this.renderSlate();
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidUpdate = (prevProps) => {
|
componentDidUpdate = async (prevProps) => {
|
||||||
console.log(this.props);
|
if (!this.props.data) {
|
||||||
console.log(prevProps);
|
return null;
|
||||||
if (this.props.data.id !== prevProps.data.id) {
|
|
||||||
this.renderSlate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.props.data.id === prevProps.data.id) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
await this.renderSlate();
|
||||||
};
|
};
|
||||||
|
|
||||||
renderSlate = async () => {
|
renderSlate = async () => {
|
||||||
for (let slate of this.props.viewer.slates) {
|
for (let slate of this.props.viewer.slates) {
|
||||||
|
if (!this.props.data) {
|
||||||
|
this.props.onAction({
|
||||||
|
type: "NAVIGATE",
|
||||||
|
value: slate.id,
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (slate.id === this.props.data.id) {
|
if (slate.id === this.props.data.id) {
|
||||||
this.props.onAction({
|
this.props.onAction({
|
||||||
type: "NAVIGATE",
|
type: "NAVIGATE",
|
||||||
@ -33,8 +45,8 @@ export default class ScenePublicSlate extends React.Component {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let slate = await Actions.getSerializedSlate({ id: this.props.data.id });
|
let slate = await Actions.getSerializedSlate({ id: this.props.data.id });
|
||||||
console.log(slate);
|
|
||||||
this.setState({ slate: slate.data });
|
this.setState({ slate: slate.data });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user