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

BOX-216: Fix tags crashing #70

Merged
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 package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"author": "github.com/cardbox",
"dependencies": {
"@cardbox/editor": "^0.1.4",
"@effector/reflect": "^0.6.0",
"@effector/reflect": "^7.0.0",
Copy link
Contributor Author

@azinit azinit Sep 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Пришлось обновить, т.к. рефлект перестал работать (см. чат)

https://t.me/c/1469541088/13935

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@azinit добавь ссылку на нужное место в чате пжлс

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Оке, не хотел светить прост)

"@svgr/webpack": "^5.5.0",
"@tippyjs/react": "^4.2.5",
"cross-fetch": "^3.0.4",
Expand Down
2 changes: 1 addition & 1 deletion src/features/card/draft/ui/atoms/tag-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import React, {
} from 'react';
import { Button, IconAdd, Input } from '@box/shared/ui';
import { combine } from 'effector';
import { reflect } from '@effector/reflect';
import { reflect } from '@effector/reflect/ssr';
import { theme } from '@box/shared/lib/theme';
import { todo } from '@box/shared/lib/todo';

Expand Down
17 changes: 8 additions & 9 deletions src/features/card/draft/ui/atoms/tags.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import React from 'react';
import styled from 'styled-components';
import { Chip } from '@box/shared/ui';
import { reflect } from '@effector/reflect';
import { reflect } from '@effector/reflect/ssr';
import { theme } from '@box/shared/lib/theme';

import * as model from '../../model';
import { $tags } from '../../model';

/**
* Теги для карточки
Expand All @@ -29,26 +28,26 @@ const TagsContainer = reflect<{ isEmpty: boolean }>({
return <TagsWrapperStyled>{children}</TagsWrapperStyled>;
},
bind: {
isEmpty: $tags.map((tags) => !tags.length),
isEmpty: model.$tags.map((tags) => !tags.length),
},
});

const ChipsView = ({
tags,
onRemove,
}: {
interface Props {
tags: string[];
onRemove: (tag: string) => void;
}) => {
}

const ChipsView = ({ tags, onRemove }: Props) => {
const handleRemove = (tag: string) => () => onRemove(tag);
return (
<>
{tags?.map((tag) => (
{tags.map((tag) => (
<Chip key={tag} label={tag} onRemove={handleRemove(tag)} />
))}
</>
);
};

const Chips = reflect({
view: ChipsView,
bind: {
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1627,10 +1627,10 @@
resolved "https://registry.yarnpkg.com/@csstools/convert-colors/-/convert-colors-1.4.0.tgz#ad495dc41b12e75d588c6db8b9834f08fa131eb7"
integrity sha512-5a6wqoJV/xEdbRNKVo6I4hO3VjyDq//8q2f9I6PBAvMesJHFauXDorcNCsr9RzvsZnaWi5NYCcfyqP1QeFHFbw==

"@effector/reflect@^0.6.0":
version "0.6.0"
resolved "https://registry.yarnpkg.com/@effector/reflect/-/reflect-0.6.0.tgz#208e05b0f696b1cdff6fc9b089616e79c90d4f2a"
integrity sha512-Dp0AldpbbIcLcxWOprRp2BW/1YYtDdK6sMSJpLnzpXuyK0cgzvp7UPwdMCy/W25Viq0um37mJxSOq5/GQJJQng==
"@effector/reflect@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/@effector/reflect/-/reflect-7.0.0.tgz#6c451c569133ed00d3cad05d13049663a5712681"
integrity sha512-qK8aLtp5fWJK5LhfA4Z6xSruhWgR1DT6mDG2rlQ3CvxS6YzXF2Shujcq7D3w91yW3R3eiOFurwJVBcBV6SbfXg==

"@emotion/is-prop-valid@^0.8.8":
version "0.8.8"
Expand Down