Skip to content

Commit

Permalink
Revert "Discriminated union type"
Browse files Browse the repository at this point in the history
This reverts commit dcc67bd.
  • Loading branch information
gbalint committed Jan 25, 2024
1 parent 8e04f24 commit d4344c9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
15 changes: 7 additions & 8 deletions editor/liveblocks.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,26 +97,25 @@ export type RoomEvent = ControlChangedRoomEvent
// each thread. Can only contain booleans, strings, and numbers.
export type ThreadMetadata = CanvasThreadMetadata | SceneThreadMetadata

export type SceneThreadMetadata = BaseThreadMetadata & {
type: 'scene'
export type SceneThreadMetadata = {
x: number
y: number
sceneId: string
sceneX: number
sceneY: number
remixLocationRoute?: string
resolved: boolean
}

export type CanvasThreadMetadata = BaseThreadMetadata & {
type: 'canvas'
}

type BaseThreadMetadata = {
export type CanvasThreadMetadata = {
x: number
y: number
remixLocationRoute?: string
resolved: boolean
}

export function isSceneThreadMetadata(metadata: ThreadMetadata): metadata is SceneThreadMetadata {
return metadata.type === 'scene'
return metadata.hasOwnProperty('sceneId')
}

export const {
Expand Down
2 changes: 0 additions & 2 deletions editor/src/components/canvas/controls/comment-popup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ const CommentThread = React.memo(({ comment }: CommentThreadProps) => {
const newThreadOnCanvas = createThread({
body,
metadata: {
type: 'canvas',
resolved: false,
x: comment.location.position.x,
y: comment.location.position.y,
Expand Down Expand Up @@ -183,7 +182,6 @@ const CommentThread = React.memo(({ comment }: CommentThreadProps) => {
const newThreadOnScene = createThread({
body,
metadata: {
type: 'scene',
resolved: false,
x: comment.location.position.x,
y: comment.location.position.x,
Expand Down

0 comments on commit d4344c9

Please sign in to comment.