Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix(core): fix viewtransition and css property missing (#7377)

EYHN824be0d4c190
diff --git a/packages/frontend/core/src/components/pure/ai-island/index.tsx b/packages/frontend/core/src/components/pure/ai-island/index.tsx
index e5517f8ef2..485a543e69 100644
--- a/packages/frontend/core/src/components/pure/ai-island/index.tsx
+++ b/packages/frontend/core/src/components/pure/ai-island/index.tsx
@@ -13,7 +13,11 @@ import {
borderAngle3,
} from './styles.css';
-if (typeof window !== 'undefined' && window.CSS) {
+if (
+ typeof window !== 'undefined' &&
+ window.CSS &&
+ window.CSS.registerProperty
+) {
const getName = (nameWithVar: string) => nameWithVar.slice(4, -1);
const registerAngle = (varName: string, initialValue: number) => {
window.CSS.registerProperty({
diff --git a/packages/frontend/core/src/modules/peek-view/view/modal-container.tsx b/packages/frontend/core/src/modules/peek-view/view/modal-container.tsx
index d8d4b063a8..ec036d89e8 100644
--- a/packages/frontend/core/src/modules/peek-view/view/modal-container.tsx
+++ b/packages/frontend/core/src/modules/peek-view/view/modal-container.tsx
@@ -103,11 +103,15 @@ export const PeekViewModalContainer = forwardRef<
) {
const [vtOpen, setVtOpen] = useState(open);
useEffect(() => {
- document.startViewTransition(() => {
- flushSync(() => {
- setVtOpen(open);
+ if (document.startViewTransition) {
+ document.startViewTransition(() => {
+ flushSync(() => {
+ setVtOpen(open);
+ });
});
- });
+ } else {
+ setVtOpen(open);
+ }
}, [open]);
useEffect(() => {