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

🐛 Fix: Remove console error in dev tools #160

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion packages/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"dependencies": {
"@atlaskit/css-reset": "^6.3.20",
"@compass/core": "1.0.0",
"@floating-ui/react": "^0.19.2",
"@floating-ui/react": "^0.26.27",
"@hello-pangea/dnd": "^16.2.0",
"@phosphor-icons/react": "^2.1.7",
"@popperjs/core": "^2.11.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ export const SomedayEvent = ({
}: Props) => {
const formType =
category === Categories_Event.SOMEDAY_WEEK ? "sidebarWeek" : "sidebarMonth";
const { y, reference, floating, strategy, context } = useEventForm(formType);
const { y, strategy, context, setReference, setFloating } =
useEventForm(formType);

const [isFocused, setIsFocused] = useState(false);

Expand Down Expand Up @@ -93,7 +94,7 @@ export const SomedayEvent = ({
role="button"
ref={provided.innerRef}
>
<div ref={reference}>
<div ref={setReference}>
<SomedayEventRectangle
category={category}
event={event}
Expand All @@ -106,7 +107,7 @@ export const SomedayEvent = ({
{shouldOpenForm && (
<FloatingFocusManager context={context}>
<StyledFloatContainer
ref={floating}
ref={setFloating}
strategy={strategy}
top={y ?? 40}
left={SIDEBAR_OPEN_WIDTH}
Expand Down
24 changes: 19 additions & 5 deletions packages/web/src/views/Forms/hooks/useEventForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ import {
offset,
shift,
useFloating,
UseFloatingProps,
UseFloatingOptions,
} from "@floating-ui/react";
import { useState } from "react";

export const useEventForm = (
eventType: "grid" | "sidebarWeek" | "sidebarMonth"
) => {
let options: Partial<UseFloatingProps>;
let options: Partial<UseFloatingOptions>;

const [reference, setReference] = useState(null);

if (eventType === "sidebarWeek" || eventType === "sidebarMonth") {
const placement = eventType === "sidebarWeek" ? "right-start" : "right";
Expand Down Expand Up @@ -40,15 +43,26 @@ export const useEventForm = (
};
}

const { x, y, reference, floating, strategy, context } = useFloating(options);
const {
x,
y,
refs: { setFloating },
strategy,
context,
} = useFloating({
...options,
elements: {
reference,
},
});

return {
x,
y,
reference,
floating,
strategy,
context,
setReference,
setFloating,
};
};

Expand Down
43 changes: 22 additions & 21 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1309,29 +1309,37 @@
dependencies:
"@floating-ui/utils" "^0.2.8"

"@floating-ui/dom@^1.0.1", "@floating-ui/dom@^1.2.1":
"@floating-ui/dom@^1.0.0":
version "1.6.12"
resolved "https://registry.yarnpkg.com/@floating-ui/dom/-/dom-1.6.12.tgz#6333dcb5a8ead3b2bf82f33d6bc410e95f54e556"
integrity sha512-NP83c0HjokcGVEMeoStg317VD9W7eDlGK7457dMBANbKA6GJZdc7rjujdgqzTaz93jkGgc5P/jeWbaCHnMNc+w==
dependencies:
"@floating-ui/core" "^1.6.0"
"@floating-ui/utils" "^0.2.8"

"@floating-ui/dom@^1.0.1":
version "1.6.11"
resolved "https://registry.yarnpkg.com/@floating-ui/dom/-/dom-1.6.11.tgz#8631857838d34ee5712339eb7cbdfb8ad34da723"
integrity sha512-qkMCxSR24v2vGkhYDo/UzxfJN3D4syqSjyuTFz6C7XcpU1pASPRieNI0Kj5VP3/503mOfYiGY891ugBX1GlABQ==
dependencies:
"@floating-ui/core" "^1.6.0"
"@floating-ui/utils" "^0.2.8"

"@floating-ui/react-dom@^1.3.0":
version "1.3.0"
resolved "https://registry.yarnpkg.com/@floating-ui/react-dom/-/react-dom-1.3.0.tgz#4d35d416eb19811c2b0e9271100a6aa18c1579b3"
integrity sha512-htwHm67Ji5E/pROEAr7f8IKFShuiCKHwUC/UY4vC3I5jiSvGFAYnSYiZO5MlGmads+QqvUkR9ANHEguGrDv72g==
"@floating-ui/react-dom@^2.1.2":
version "2.1.2"
resolved "https://registry.yarnpkg.com/@floating-ui/react-dom/-/react-dom-2.1.2.tgz#a1349bbf6a0e5cb5ded55d023766f20a4d439a31"
integrity sha512-06okr5cgPzMNBy+Ycse2A6udMi4bqwW/zgBF/rwjcNqWkyr82Mcg8b0vjX8OJpZFy/FKjJmw6wV7t44kK6kW7A==
dependencies:
"@floating-ui/dom" "^1.2.1"
"@floating-ui/dom" "^1.0.0"

"@floating-ui/react@^0.19.2":
version "0.19.2"
resolved "https://registry.yarnpkg.com/@floating-ui/react/-/react-0.19.2.tgz#c6e4d2097ed0dca665a7c042ddf9cdecc95e9412"
integrity sha512-JyNk4A0Ezirq8FlXECvRtQOX/iBe5Ize0W/pLkrZjfHW9GUV7Xnq6zm6fyZuQzaHHqEnVizmvlA96e1/CkZv+w==
"@floating-ui/react@^0.26.27":
version "0.26.27"
resolved "https://registry.yarnpkg.com/@floating-ui/react/-/react-0.26.27.tgz#402f7b4b2702650662705fe9cbe0f1d5607846a1"
integrity sha512-jLP72x0Kr2CgY6eTYi/ra3VA9LOkTo4C+DUTrbFgFOExKy3omYVmwMjNKqxAHdsnyLS96BIDLcO2SlnsNf8KUQ==
dependencies:
"@floating-ui/react-dom" "^1.3.0"
aria-hidden "^1.1.3"
tabbable "^6.0.1"
"@floating-ui/react-dom" "^2.1.2"
"@floating-ui/utils" "^0.2.8"
tabbable "^6.0.0"

"@floating-ui/utils@^0.2.8":
version "0.2.8"
Expand Down Expand Up @@ -3187,13 +3195,6 @@ argparse@^2.0.1:
resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38"
integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==

aria-hidden@^1.1.3:
version "1.2.4"
resolved "https://registry.yarnpkg.com/aria-hidden/-/aria-hidden-1.2.4.tgz#b78e383fdbc04d05762c78b4a25a501e736c4522"
integrity sha512-y+CcFFwelSXpLZk/7fMB2mUbGtX9lKycf1MWJ7CaTIERyitVlyQx6C+sxcROU2BAJ24OiZyK+8wj2i8AlBoS3A==
dependencies:
tslib "^2.0.0"

[email protected], aria-query@~5.1.3:
version "5.1.3"
resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-5.1.3.tgz#19db27cd101152773631396f7a95a3b58c22c35e"
Expand Down Expand Up @@ -10174,7 +10175,7 @@ symbol-tree@^3.2.4:
resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2"
integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==

tabbable@^6.0.1, tabbable@^6.2.0:
tabbable@^6.0.0, tabbable@^6.2.0:
version "6.2.0"
resolved "https://registry.yarnpkg.com/tabbable/-/tabbable-6.2.0.tgz#732fb62bc0175cfcec257330be187dcfba1f3b97"
integrity sha512-Cat63mxsVJlzYvN51JmVXIgNoUokrIaT2zLclCXjRd8boZ0004U4KCs/sToJ75C6sdlByWxpYnb5Boif1VSFew==
Expand Down