Skip to content

Commit

Permalink
removed @blocknote/core from dependencies (#6580)
Browse files Browse the repository at this point in the history
Fixes #6564  & #6561 

@FelixMalfait 

Removed @blocknote/core from dependencies



https://github.com/user-attachments/assets/ef6acfff-2945-4062-a35c-21dd108a4345

---------

Co-authored-by: Félix Malfait <[email protected]>
  • Loading branch information
ehconitin and FelixMalfait authored Aug 8, 2024
1 parent c3bf94e commit 774cb55
Show file tree
Hide file tree
Showing 21 changed files with 8,324 additions and 10,025 deletions.
894 changes: 0 additions & 894 deletions .yarn/releases/yarn-4.3.1.cjs

This file was deleted.

925 changes: 925 additions & 0 deletions .yarn/releases/yarn-4.4.0.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ enableInlineHunks: true

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.3.1.cjs
yarnPath: .yarn/releases/yarn-4.4.0.cjs
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"@aws-sdk/client-lambda": "^3.614.0",
"@aws-sdk/client-s3": "^3.363.0",
"@aws-sdk/credential-providers": "^3.363.0",
"@blocknote/core": "^0.15.3",
"@blocknote/mantine": "^0.15.3",
"@blocknote/react": "^0.15.3",
"@chakra-ui/accordion": "^2.3.0",
Expand Down Expand Up @@ -259,6 +258,7 @@
"@types/graphql-upload": "^8.0.12",
"@types/jest": "^29.5.11",
"@types/js-cookie": "^3.0.3",
"@types/js-levenshtein": "^1.1.3",
"@types/lodash.camelcase": "^4.3.7",
"@types/lodash.compact": "^3.0.9",
"@types/lodash.debounce": "^4.0.7",
Expand Down
2 changes: 1 addition & 1 deletion packages/twenty-front/src/hooks/useIsMatchingLocation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const useIsMatchingLocation = () => {
return useCallback(
(path: string, basePath?: AppBasePath) => {
const constructedPath = basePath
? new URL(basePath + path, document.location.origin).pathname ?? ''
? (new URL(basePath + path, document.location.origin).pathname ?? '')
: path;

return !!matchPath(constructedPath, location.pathname);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const MessageThreadSubscribersChip = ({
? `+${numberOfMessageThreadSubscribers - MAX_NUMBER_OF_AVATARS}`
: null;

const label = isPrivateThread ? privateLabel : moreAvatarsLabel ?? '';
const label = isPrivateThread ? privateLabel : (moreAvatarsLabel ?? '');

return (
<Chip
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
ServerError,
ServerParseError,
} from '@apollo/client';
import { GraphQLErrors } from '@apollo/client/errors';
import { setContext } from '@apollo/client/link/context';
import { onError } from '@apollo/client/link/error';
import { RetryLink } from '@apollo/client/link/retry';
Expand All @@ -17,13 +16,14 @@ import { AuthTokenPair } from '~/generated/graphql';
import { isDefined } from '~/utils/isDefined';
import { logDebug } from '~/utils/logDebug';

import { GraphQLFormattedError } from 'graphql';
import { ApolloManager } from '../types/apolloManager.interface';
import { loggerLink } from '../utils';

const logger = loggerLink(() => 'Twenty');

export interface Options<TCacheShape> extends ApolloClientOptions<TCacheShape> {
onError?: (err: GraphQLErrors | undefined) => void;
onError?: (err: GraphQLFormattedError | undefined) => void;
onNetworkError?: (err: Error | ServerParseError | ServerError) => void;
onTokenPairChange?: (tokenPair: AuthTokenPair) => void;
onUnauthenticatedError?: () => void;
Expand Down Expand Up @@ -80,9 +80,9 @@ export class ApolloFactory<TCacheShape> implements ApolloManager<TCacheShape> {
const errorLink = onError(
({ graphQLErrors, networkError, forward, operation }) => {
if (isDefined(graphQLErrors)) {
onErrorCb?.(graphQLErrors);

for (const graphQLError of graphQLErrors) {
onErrorCb?.(graphQLError);

if (graphQLError.message === 'Unauthorized') {
return fromPromise(
renewToken(uri, this.tokenPair)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,17 +143,16 @@ export const ObjectMetadataNavItems = ({ isRemote }: { isRemote: boolean }) => {
: viewA.position - viewB.position,
)
.map((view) => (
<div>
<NavigationDrawerSubItem
label={view.name}
to={`/objects/${objectMetadataItem.namePlural}?view=${view.id}`}
active={
currentPathWithSearch ===
`/objects/${objectMetadataItem.namePlural}?view=${view.id}`
}
Icon={getIcon(view.icon)}
/>
</div>
<NavigationDrawerSubItem
label={view.name}
to={`/objects/${objectMetadataItem.namePlural}?view=${view.id}`}
active={
currentPathWithSearch ===
`/objects/${objectMetadataItem.namePlural}?view=${view.id}`
}
Icon={getIcon(view.icon)}
key={view.id}
/>
))}
</motion.div>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ObjectRecord } from '@/object-record/types/ObjectRecord';
export const generateDefaultRecordChipData = (record: ObjectRecord) => {
const name = isFieldFullNameValue(record.name)
? record.name.firstName + ' ' + record.name.lastName
: record.name ?? '';
: (record.name ?? '');

return {
name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const getRecordsFromRecordConnection = <T extends ObjectRecord>({
}: {
recordConnection: RecordGqlConnection;
}): T[] => {
return recordConnection.edges.map((edge) =>
return recordConnection?.edges?.map((edge) =>
getRecordFromRecordNode<T>({ recordNode: edge.node }),
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ export const MultiSelectFieldInput = ({
const [searchFilter, setSearchFilter] = useState('');
const containerRef = useRef<HTMLDivElement>(null);

const selectedOptions = fieldDefinition.metadata.options.filter(
(option) => fieldValues?.includes(option.value),
const selectedOptions = fieldDefinition.metadata.options.filter((option) =>
fieldValues?.includes(option.value),
);

const optionsInDropDown = fieldDefinition.metadata.options;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export const RecordIndexBoardDataLoader = ({
boardFieldSelectValue={option.value}
recordBoardId={recordBoardId}
columnId={columnIds[index]}
key={index}
/>
))}
{recordIndexKanbanFieldMetadataItem?.isNullable && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export const RecordDetailRelationSection = ({
const relationRecords: ObjectRecord[] =
fieldValue && isToOneObject
? [fieldValue as ObjectRecord]
: (fieldValue as ObjectRecord[]) ?? [];
: ((fieldValue as ObjectRecord[]) ?? []);

const relationRecordIds = relationRecords.map(({ id }) => id);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ export const findUnmatchedRequiredFields = <T extends string>(
columns: Columns<T>,
) =>
fields
.filter(
(field) =>
field.fieldValidationDefinitions?.some(
(validation) => validation.rule === 'required',
),
.filter((field) =>
field.fieldValidationDefinitions?.some(
(validation) => validation.rule === 'required',
),
)
.filter(
(field) =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import styled from '@emotion/styled';
import { useEffect, useRef, useState } from 'react';
import ReactPhoneNumberInput from 'react-phone-number-input';
import styled from '@emotion/styled';
import { TEXT_INPUT_STYLE } from 'twenty-ui';

import { LightCopyIconButton } from '@/object-record/record-field/components/LightCopyIconButton';
import { useRegisterInputEvents } from '@/object-record/record-field/meta-types/input/hooks/useRegisterInputEvents';
import { PhoneCountryPickerDropdownButton } from '@/ui/input/components/internal/phone/components/PhoneCountryPickerDropdownButton';

import { E164Number } from 'libphonenumber-js';
import 'react-phone-number-input/style.css';

const StyledContainer = styled.div`
Expand Down Expand Up @@ -89,9 +90,9 @@ export const PhoneInput = ({
const wrapperRef = useRef<HTMLDivElement>(null);
const copyRef = useRef<HTMLDivElement>(null);

const handleChange = (newValue: string) => {
const handleChange = (newValue: E164Number) => {
setInternalValue(newValue);
onChange?.(newValue);
onChange?.(newValue as string);
};

useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ export type FloatingButtonProps = {
to?: string;
};

const StyledButton = styled.button<
const shouldForwardProp = (prop: string) =>
!['applyBlur', 'applyShadow', 'focus', 'position', 'size', 'to'].includes(
prop,
);

const StyledButton = styled('button', { shouldForwardProp })<
Pick<
FloatingButtonProps,
| 'size'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { css, useTheme } from '@emotion/react';
import styled from '@emotion/styled';
import React from 'react';
import { IconComponent } from 'twenty-ui';

export type FloatingIconButtonSize = 'small' | 'medium';
Expand All @@ -22,8 +22,17 @@ export type FloatingIconButtonProps = {
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
isActive?: boolean;
};
const shouldForwardProp = (prop: string) =>
![
'applyBlur',
'applyShadow',
'isActive',
'focus',
'position',
'size',
].includes(prop);

const StyledButton = styled.button<
const StyledButton = styled('button', { shouldForwardProp })<
Pick<
FloatingIconButtonProps,
'size' | 'position' | 'applyShadow' | 'applyBlur' | 'focus' | 'isActive'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useEffect, useState } from 'react';
import styled from '@emotion/styled';
import { motion } from 'framer-motion';
import { useEffect, useState } from 'react';

import { isDefined } from '~/utils/isDefined';

Expand All @@ -16,7 +16,7 @@ type ContainerProps = {
const StyledContainer = styled.div<ContainerProps>`
align-items: center;
background-color: ${({ theme, isOn, color }) =>
isOn ? color ?? theme.color.blue : theme.background.quaternary};
isOn ? (color ?? theme.color.blue) : theme.background.quaternary};
border-radius: 10px;
cursor: pointer;
display: flex;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Profiler } from 'react';
import { Interaction } from 'scheduler/tracing';
import { Profiler, ProfilerOnRenderCallback } from 'react';

import { logDebug } from '~/utils/logDebug';

Expand All @@ -9,14 +8,13 @@ type TimingProfilerProps = {
};

export const TimingProfiler = ({ id, children }: TimingProfilerProps) => {
const handleRender = (
const handleRender: ProfilerOnRenderCallback = (
id: string,
phase: 'mount' | 'update' | 'nested-update',
actualDuration: number,
baseDuration: number,
startTime: number,
commitTime: number,
interactions: Set<Interaction>,
) => {
logDebug(
'TimingProfiler',
Expand All @@ -28,7 +26,6 @@ export const TimingProfiler = ({ id, children }: TimingProfilerProps) => {
baseDuration,
startTime,
commitTime,
interactions,
},
null,
2,
Expand Down
20 changes: 10 additions & 10 deletions packages/twenty-front/src/testing/graphqlMocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,16 @@ export const graphqlMocks = {
graphql.query('CombinedFindManyRecords', () => {
return HttpResponse.json({
data: {
favorites: {
edges: [],
totalCount: 0,
pageInfo: {
hasNextPage: false,
hasPreviousPage: false,
startCursor: null,
endCursor: null,
},
},
views: {
edges: mockedViewsData.map((view) => ({
node: {
Expand Down Expand Up @@ -150,16 +160,6 @@ export const graphqlMocks = {
totalCount: mockedViewsData.length,
},
},
favorites: {
edges: [],
totalCount: 0,
pageInfo: {
hasNextPage: false,
hasPreviousPage: false,
startCursor: null,
endCursor: null,
},
},
});
}),
graphql.query('FindManyCompanies', ({ variables }) => {
Expand Down
Loading

0 comments on commit 774cb55

Please sign in to comment.