File tree Expand file tree Collapse file tree 3 files changed +7
-7
lines changed
frontend/components/Bookmark Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -203,8 +203,7 @@ export default function BookmarkCard({ bookmark }: Readonly<BookmarkProp>) {
203203 } ) ;
204204 }
205205
206- const onDeleteTag = ( title : string ) => {
207- const idx = getIdxFromTitle ( title ) ;
206+ const onDeleteTag = ( idx : number ) => {
208207 const tagId = bookmark . tags [ idx ] . id ;
209208 if ( currentBookmark . current ) {
210209 currentBookmark . current . tags = currentBookmark . current . tags . filter (
@@ -229,6 +228,7 @@ export default function BookmarkCard({ bookmark }: Readonly<BookmarkProp>) {
229228 addTagToBookmark ( bookmark , tag ) . then ( ( action ) => {
230229 dispatch ( action ) ;
231230 setStrTags ( [ ...strTags , tag ] ) ;
231+ currentBookmark . current . tags . push ( { id : action . id , title : action . title } ) ;
232232 } ) ;
233233
234234 function getIdxFromTitle ( title : string ) : number {
Original file line number Diff line number Diff line change @@ -242,7 +242,7 @@ export default function NewBookmarkCard() {
242242 tags = { strTags }
243243 inputValue = { tagInput }
244244 setInputValue = { setTagInput }
245- onDeleteTag = { ( _ , index ) => deleteTag ( index , setFieldValue ) }
245+ onDeleteTag = { ( index ) => deleteTag ( index , setFieldValue ) }
246246 onPushTag = { ( tag ) => onPushTag ( tag , setFieldValue ) }
247247 testIdPrefix = "new-bk-"
248248 > </ TagInput >
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ const TagInput = (props: {
55 tags : readonly string [ ] ;
66 inputValue : string ;
77 setInputValue : ( val : string ) => void ;
8- onDeleteTag : ( tag : string , index : number ) => void ;
8+ onDeleteTag : ( index : number ) => void ;
99 onPushTag : ( tag : string ) => void ;
1010 testIdPrefix : `bk-${string } -` | `new-bk-`;
1111} ) => {
@@ -28,7 +28,7 @@ const TagInput = (props: {
2828 const tagsCopy = [ ...props . tags ] ;
2929 const poppedTag = tagsCopy . pop ( ) ;
3030 if ( poppedTag ) {
31- props . onDeleteTag ( poppedTag , props . tags . length - 1 ) ;
31+ props . onDeleteTag ( props . tags . length - 1 ) ;
3232 props . setInputValue ( poppedTag ) ;
3333 }
3434 }
@@ -39,10 +39,10 @@ const TagInput = (props: {
3939 { props . tags . map ( ( tag , index ) => (
4040 < button
4141 key = { tag }
42- onClick = { ( ) => props . onDeleteTag ( tag , index ) }
42+ onClick = { ( ) => props . onDeleteTag ( index ) }
4343 onContextMenu = { ( e ) => {
4444 e . preventDefault ( ) ;
45- props . onDeleteTag ( tag , index ) ;
45+ props . onDeleteTag ( index ) ;
4646 } }
4747 type = "button"
4848 className = { style . pillButton }
You can’t perform that action at this time.
0 commit comments