Skip to content

Commit

Permalink
🐛 (bubbles) Fix giphy search input buggy
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Oct 6, 2022
1 parent bfed599 commit 88c4076
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { GiphyFetch } from '@giphy/js-fetch-api'
import { Grid } from '@giphy/react-components'
import { GiphyLogo } from 'assets/logos'
import React, { useState } from 'react'
import { useDebounce } from 'use-debounce'
import { env, isEmpty } from 'utils'
import { Input } from '../Textbox'

Expand All @@ -14,6 +15,7 @@ const giphyFetch = new GiphyFetch(env('GIPHY_API_KEY') as string)

export const GiphySearchForm = ({ onSubmit }: GiphySearchFormProps) => {
const [inputValue, setInputValue] = useState('')
const [debouncedInputValue] = useDebounce(inputValue, 500)

const fetchGifs = (offset: number) =>
giphyFetch.search(inputValue, { offset, limit: 10 })
Expand All @@ -38,12 +40,12 @@ export const GiphySearchForm = ({ onSubmit }: GiphySearchFormProps) => {
</Flex>
<Flex overflowY="scroll" maxH="400px">
<Grid
key={inputValue}
key={debouncedInputValue}
onGifClick={(gif, e) => {
e.preventDefault()
onSubmit(gif.images.downsized.url)
}}
fetchGifs={inputValue === '' ? fetchGifsTrending : fetchGifs}
fetchGifs={debouncedInputValue === '' ? fetchGifsTrending : fetchGifs}
width={475}
columns={3}
className="my-4"
Expand Down
3 changes: 2 additions & 1 deletion apps/builder/playwright/tests/bubbles/image.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ test.describe.parallel('Image bubble block', () => {
)
const trendingfirstImageSrc = await firstGiphyImage.getAttribute('src')
expect(trendingfirstImageSrc).toMatch(new RegExp('giphy.com/media', 'gm'))
await page.fill('[placeholder="Search..."]', 'fun')
await page.type('[placeholder="Search..."]', 'fun')
await expect(page.locator('[placeholder="Search..."]')).toHaveValue('fun')
await page.waitForTimeout(500)
await expect(firstGiphyImage).toHaveAttribute(
'src',
Expand Down

5 comments on commit 88c4076

@vercel
Copy link

@vercel vercel bot commented on 88c4076 Oct 6, 2022

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

builder-v2 – ./apps/builder

builder-v2-git-main-typebot-io.vercel.app
app.typebot.io
builder-v2-typebot-io.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 88c4076 Oct 6, 2022

Choose a reason for hiding this comment

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

@vercel
Copy link

@vercel vercel bot commented on 88c4076 Oct 6, 2022

Choose a reason for hiding this comment

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

@vercel
Copy link

@vercel vercel bot commented on 88c4076 Oct 6, 2022

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

viewer-v2-alpha – ./apps/viewer

247987.com
minipost.uk
biiapp.com
finplex.be
bot.aws.bj
8jours.top
ns8.vn
sat.cr8.ai
yobot.me
bot.aipr.kr
am.nigerias.io
an.nigerias.io
bt.id8rs.com
bot.krdfy.com
vhpage.cr8.ai
ar.nigerias.io
apo.nigerias.io
ticketfute.com
bot.enreso.org
bot.lalmon.com
apr.nigerias.io
aso.nigerias.io
bot.artiweb.app
bot.tc-mail.com
games.klujo.com
chat.sureb4.com
eventhub.com.au
bot.ageenda.com
sakuranembro.it
typebot.aloe.do
bot.piccinato.co
bot.upfunnel.art
botc.ceox.com.br
clo.closeer.work
faqs.nigerias.io
kw.wpwakanda.com
feedback.ofx.one
stan.vselise.com
myrentalhost.com
form.syncwin.com
app.chatforms.net
voicehelp.cr8.ai
typebot.aloe.bot
bot.agfunnel.tech
bot.hostnation.de
bot.reviewzer.com
cares.urlabout.me
bot.maitempah.com
bot.phuonghub.com
fmm.wpwakanda.com
lb.ticketfute.com
ov1.wpwakanda.com
k1.kandabrand.com
gentleman-shop.fr
1988.bouclidom.com
bot.megafox.com.br
ov2.wpwakanda.com
andreimayer.com.br
ov3.wpwakanda.com
bot.neferlopez.com
bots.robomotion.io
cadu.uninta.edu.br
goalsettingbot.com
dicanatural.online
positivobra.com.br
bot.digitalbled.com
zap.techadviser.in
survey.digienge.io
this-is-a-test.com
bot.eventhub.com.au
demo.botscientis.us
carsalesenquiry.com
forms.webisharp.com
kbsub.wpwakanda.com
live.botscientis.us
mentoria.omelhor.vc
nutrisamirbayde.com
order.maitempah.com
quest.wpwakanda.com
test.botscientis.us
bot.ansuraniphone.my
typebot.stillio.com
bium.gratirabbit.com
bot.cotemeuplano.com
chat.hayurihijab.com
chatbee.agfunnel.com
kuiz.sistemniaga.com
connect.growthguy.in
get.freebotoffer.xyz
click.sevenoways.com
offer.botscientis.us
talkbot.agfunnel.com
tenorioadvogados.com
uppity.wpwakanda.com
abutton.wpwakanda.com
aidigitalmarketing.kr
bot.meuesocial.com.br
bot.ramonmatos.com.br
bbutton.wpwakanda.com
bot.incusservices.com

@vercel
Copy link

@vercel vercel bot commented on 88c4076 Oct 6, 2022

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

docs – ./apps/docs

docs-git-main-typebot-io.vercel.app
docs.typebot.io
docs-typebot-io.vercel.app

Please sign in to comment.