Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v9] fix(reconciler): don't implement (un)hideInstance methods #3241

Merged
merged 2 commits into from
Apr 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 2 additions & 23 deletions packages/fiber/src/core/reconciler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ export interface Instance<O = any> {
handlers: Partial<EventHandlers>
attach?: AttachType<O>
previousAttach?: any
isHidden: boolean
autoRemovedBeforeAppend?: boolean
}

Expand Down Expand Up @@ -407,28 +406,8 @@ export const reconciler = Reconciler<
resetAfterCommit: () => {},
shouldSetTextContent: () => false,
clearContainer: () => false,
hideInstance(instance) {
if (instance.props.attach && instance.parent?.object) {
detach(instance.parent, instance)
} else if (isObject3D(instance.object)) {
instance.object.visible = false
}

instance.isHidden = true
invalidateInstance(instance)
},
unhideInstance(instance) {
if (instance.isHidden) {
if (instance.props.attach && instance.parent?.object) {
attach(instance.parent, instance)
} else if (isObject3D(instance.object) && instance.props.visible !== false) {
instance.object.visible = true
}
}

instance.isHidden = false
invalidateInstance(instance)
},
hideInstance() {},
unhideInstance() {},
createTextInstance: handleTextInstance,
hideTextInstance: handleTextInstance,
unhideTextInstance: handleTextInstance,
Expand Down
1 change: 0 additions & 1 deletion packages/fiber/src/core/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ export function prepare<T = any>(target: T, root: RootStore, type: string, props
object,
eventCount: 0,
handlers: {},
isHidden: false,
}
if (object) {
object.__r3f = instance
Expand Down