Skip to content

Commit

Permalink
fix: mobx warnings and react render phase set state error
Browse files Browse the repository at this point in the history
  • Loading branch information
amanharwara committed Oct 20, 2022
1 parent 4f3b258 commit 76f23e1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
9 changes: 4 additions & 5 deletions packages/web/src/javascripts/Components/Tags/TagsListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,11 @@ export const TagsListItem: FunctionComponent<Props> = observer(
const toggleChildren: MouseEventHandler = useCallback(
(e) => {
e.stopPropagation()
setShowChildren((x) => {
tagsState.setExpanded(tag, !x)
return !x
})
const shouldShowChildren = !showChildren
setShowChildren(shouldShowChildren)
tagsState.setExpanded(tag, !shouldShowChildren)
},
[setShowChildren, tag, tagsState],
[showChildren, tag, tagsState],
)

const selectCurrentTag = useCallback(async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ export class ItemListController

optionsSubtitle: computed,
activeControllerItem: computed,

hydrateFromPersistedValue: action,
})

window.onresize = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export class SelectedItemsController

private replaceSelection = (item: ListableContentItem): void => {
this.deselectAll()
this.setSelectedUuids(this.selectedUuids.add(item.uuid))
runInAction(() => this.setSelectedUuids(this.selectedUuids.add(item.uuid)))

this.lastSelectedItem = item
}
Expand Down

0 comments on commit 76f23e1

Please sign in to comment.