Skip to content
Open
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
6 changes: 6 additions & 0 deletions .changeset/forty-forks-shave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@suid/material": patch
"@suid/base": patch
---

fix(material): make appear working
24 changes: 18 additions & 6 deletions packages/base/src/Transition/Transition.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,25 @@ export function Transition(inProps: TransitionProps) {

createEffect((firstTime) => {
if (props.in) {
untrack(() => props.onEnter?.());
setStatus("entering");
untrack(() => {
if (status() !== "entering" && status() !== "entered") {
props.onEnter?.();
setStatus("entering");
}
});
} else {
if (!firstTime) {
untrack(() => props.onExit?.());
setStatus("exiting");
}
untrack(() => {
if (!firstTime) {
if (
status() !== "exiting" &&
status() !== "exited" &&
status() !== "unmounted"
) {
props.onExit?.();
setStatus("exiting");
}
}
});
}
return false;
}, true);
Expand Down
23 changes: 18 additions & 5 deletions packages/material/src/Drawer/Drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@ import { getDrawerUtilityClass } from "./drawerClasses";
import createComponentFactory from "@suid/base/createComponentFactory";
import createElementRef from "@suid/system/createElementRef";
import clsx from "clsx";
import { children, createSignal, Match, onMount, Switch } from "solid-js";
import {
children,
createMemo,
createSignal,
Match,
onMount,
Switch,
} from "solid-js";

const $ = createComponentFactory<DrawerTypeMap>()({
name: "MuiDrawer",
Expand Down Expand Up @@ -190,11 +197,9 @@ const Drawer = $.component(function Drawer({
// We use this state is order to skip the appear transition during the
// initial mount of the component.

const [mounted, setMounted] = createSignal(false);
const element = createElementRef(otherProps);
const theme = useTheme();
const resolved = children(() => props.children);
onMount(() => setMounted(true));

function InternalDrawer() {
return (
Expand All @@ -211,6 +216,8 @@ const Drawer = $.component(function Drawer({
}

function SlidingDrawer() {
const [mounted, setMounted] = createSignal(false);
onMount(() => setMounted(true));
const anchorInvariant = getAnchor(theme, props.anchor) as Anchor;

return (
Expand All @@ -225,6 +232,12 @@ const Drawer = $.component(function Drawer({
</Slide>
);
}
const slidingDrawerVisible = createMemo(
() => props.variant === "persistent" || props.variant === "temporary"
);
const resolvedSlidingDrawer = children(
() => slidingDrawerVisible() && <SlidingDrawer />
);

return (
<Switch>
Expand All @@ -245,7 +258,7 @@ const Drawer = $.component(function Drawer({
ownerState={allProps}
ref={element}
>
<SlidingDrawer />
{resolvedSlidingDrawer()}
</DrawerDockedRoot>
</Match>
{
Expand All @@ -266,7 +279,7 @@ const Drawer = $.component(function Drawer({
{...(props.ModalProps ?? {})}
transition
>
<SlidingDrawer />
{resolvedSlidingDrawer()}
</DrawerRoot>
</Match>
}
Expand Down