Files
speckle-server/packages/frontend-2/lib/viewer/composables/setup/urlHashState.ts
T
Kristaps Fabians Geikins 9427686d42 fix(fe2): various follow mode & thread viewer state sync fixes & improvements (#1595)
* fix(fe2): unfollow on camera move

* WIP new state hydration function

* WIP sync state

* minor cleanup

* fix coloring not being tracked

* fix for post thread close camera pos restore

* supporting duplicate users

* preventing guest commenting + state reset fixes

* fixed guests not receiving viewer comment updates

* post-thread creation opens new thread

* removing gap between 'X is typing' and bubble appearing

* reset filters will also reset colors now

* fixed thread full context

* camera reset fix

* thread reset fix

* fixed router concurrency issues

* followed user avatar fix

* TONS OF DEBUGGING FOR ROUTER QUEUING

* removing queued routing debugging stuff + disabling spotlight cancelation

* WIP async URL updates

* missing authLogger fixed

* fix for broken projection

* fix for bubbles positions not updating correctly

* queued routing cleanup

* fixed spotlight mode disabling unnecessarily

* added back stoplight stop on ctrl

* undid spotlight debugging
2023-05-29 15:20:32 +03:00

27 lines
757 B
TypeScript

import { writableAsyncComputed } from '~~/lib/common/composables/async'
import { useRouteHashState } from '~~/lib/common/composables/url'
import type { InjectableViewerState } from '~~/lib/viewer/composables/setup'
export enum ViewerHashStateKeys {
FocusedThreadId = 'threadId'
}
export function setupUrlHashState(): InjectableViewerState['urlHashState'] {
const { hashState } = useRouteHashState()
const focusedThreadId = writableAsyncComputed({
get: () => hashState.value[ViewerHashStateKeys.FocusedThreadId] || null,
set: async (newVal) => {
await hashState.update({
...hashState.value,
[ViewerHashStateKeys.FocusedThreadId]: newVal
})
},
initialState: null
})
return {
focusedThreadId
}
}