Skip to content

Commit 41b3c17

Browse files
Fix crash due to setUser not being called
1 parent dc9e593 commit 41b3c17

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

src/components/AssistantView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class AssistantView extends React.Component<Props, State> implements SessionCont
4343
constructor(props: Props) {
4444
super(props);
4545
this.state = {
46-
user: SessionController.getInstance().user,
46+
user: { id: '', name: 'User' },
4747
sessionState: SessionController.getInstance().sessionState,
4848
chatMessages: SessionController.getInstance().chatMessages,
4949
isProcessing: false,

src/controllers/SessionController.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export interface SessionControllerEventListener {
1515

1616
class SessionController implements SLWebSocketEventListener {
1717
listeners: SessionControllerEventListener[] = [];
18-
user: { id: string, name: string } | null = null;
1918
projectID: string = "main";
2019
sessionState: SessionState = 'initializing';
2120
error: string | null = null;
@@ -48,8 +47,7 @@ class SessionController implements SLWebSocketEventListener {
4847
this.listeners.splice(index, 1);
4948
}
5049

51-
initialize(user: { id: string, name: string }) {
52-
this.user = user;
50+
initialize() {
5351
if (!this.authToken) {
5452
console.log("Couldn't get session due to missing auth token.")
5553
return

src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class Superluminal extends React.Component<Props, State> {
2525
console.log('You must provide a valid Superluminal auth token.');
2626
}
2727
SessionController.getInstance().authToken = props.authToken;
28+
SessionController.getInstance().initialize();
2829
}
2930

3031
render() {
@@ -49,7 +50,6 @@ class Superluminal extends React.Component<Props, State> {
4950
if (!user.name) {
5051
return console.log('You must provide a valid user name.');
5152
}
52-
SessionController.getInstance().initialize(user);
5353
this.assistantViewRef.current?.setUser(user);
5454
}
5555
}

0 commit comments

Comments
 (0)