MCPcopy Create free account
hub / github.com/async-labs/async / componentDidMount

Method componentDidMount

app/components/comments/CommentForm.tsx:53–67  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

51
52 // getting content for non-first comment from local storage
53 public componentDidMount() {
54 const { discussion, comment, teamId } = this.props;
55
56 // no need to include userId since it's user's browser
57 this.storageKey = `content-${teamId}-${
58 discussion ? discussion.discussionId : 'new-discussion'
59 }-${comment ? comment.commentId : 'new-comment'}`;
60
61 const draftContent =
62 (typeof localStorage !== 'undefined' && localStorage.getItem(this.storageKey)) || '';
63
64 if (draftContent) {
65 this.setState({ content: draftContent });
66 }
67 }
68
69 public componentDidUpdate(prevProps: Props) {
70 const { discussion, comment, teamId } = this.props;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected