refactor(spx-gui): replace naive-ui dropdown and tooltip popups#3032
refactor(spx-gui): replace naive-ui dropdown and tooltip popups#3032cn0809 wants to merge 1 commit intogoplus:devfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request replaces the Naive UI-based UIDropdown and UITooltip components with a custom implementation using @floating-ui/dom and a new internal popup management system. It includes updates to UIConfigProvider and UIModal to support this foundation, along with simplified class merging across multiple UI components. Review feedback identifies a logic error in the resolveMaybeRef utility and a functional issue where nested teleported popups may cause parent dropdowns to close prematurely.
| function resolveMaybeRef<T>(value: MaybeRefOrGetter<T> | null | undefined): T | null | ||
| function resolveMaybeRef<T>(value: MaybeRefOrGetter<T> | null | undefined, fallback: T): T | ||
| function resolveMaybeRef<T>(value: MaybeRefOrGetter<T> | null | undefined, fallback?: T) { | ||
| if (value == null) return fallback ?? null | ||
| return toValue(value) as T | ||
| } |
There was a problem hiding this comment.
The resolveMaybeRef function does not correctly apply the fallback when the provided MaybeRefOrGetter resolves to null or undefined. It only checks if the value (the ref or getter itself) is nullish. If a ref is passed but its current value is undefined, the fallback will be ignored, which likely isn't the intended behavior for default values like placement or offset.
| function resolveMaybeRef<T>(value: MaybeRefOrGetter<T> | null | undefined): T | null | |
| function resolveMaybeRef<T>(value: MaybeRefOrGetter<T> | null | undefined, fallback: T): T | |
| function resolveMaybeRef<T>(value: MaybeRefOrGetter<T> | null | undefined, fallback?: T) { | |
| if (value == null) return fallback ?? null | |
| return toValue(value) as T | |
| } | |
| function resolveMaybeRef<T>(value: MaybeRefOrGetter<T> | null | undefined): T | null | |
| function resolveMaybeRef<T>(value: MaybeRefOrGetter<T> | null | undefined, fallback: T): T | |
| function resolveMaybeRef<T>(value: MaybeRefOrGetter<T> | null | undefined, fallback?: T) { | |
| const resolved = value == null ? undefined : toValue(value) | |
| return (resolved ?? fallback) ?? null | |
| } |
close: #3015