Skip to main content

The code works fine without using Airtable SDK. Any ideas on what can be causing this?


You can see it working here: vibrant-snow-m8sl6 - CodeSandbox



Here’s my code using Airtable’s initializeBlock() :



import React, { useState } from 'react';

import { initializeBlock } from '@airtable/blocks/ui';



import {

Dropdown,

Field,

Menu,

Item,

Select,

Label,

} from '@zendeskgarden/react-dropdowns';



interface IItem {

label: string;

value: string;

}



const items = s

{ label: 'Fern', value: 'item-1' },

{ label: 'Snake plant', value: 'item-2' },

{ label: 'Rubber tree', value: 'item-3' },

];



const App = () => {

const nselectedItem, setSelectedItem] = useState(itemst0]);



return (

<Dropdown

selectedItem={selectedItem}

onSelect={setSelectedItem}

downshiftProps={{

itemToString: (item: IItem) => item && item.label,

}}

>

<Field>

<Label>Houseplant</Label>

<Select>{selectedItem.label}</Select>

</Field>

<Menu>

{items.map((option) => (

<Item key={option.value} value={option}>

{option.label}

</Item>

))}

</Menu>

</Dropdown>

);

};



initializeBlock(() => <App />);



Error:




Hi @Luis_Brito ,



Sorry you’re running into trouble here. Unfortunately, I wasn’t able to reproduce this error locally. In my attempt to reproduce, I started from scratch, copied your code in, then installed @zendeskgarden/react-dropdowns and it’s required dependencies: styled-components & @zendeskgarden/react-theming.



If you’re still running into this issue, could you share the error that’s occurring (it should be the line above what you screenshotted in your message). It also might be helpful to see your package.json for debugging purposes.



Cheers,


Billy




Hi @Luis_Brito ,



Sorry you’re running into trouble here. Unfortunately, I wasn’t able to reproduce this error locally. In my attempt to reproduce, I started from scratch, copied your code in, then installed @zendeskgarden/react-dropdowns and it’s required dependencies: styled-components & @zendeskgarden/react-theming.



If you’re still running into this issue, could you share the error that’s occurring (it should be the line above what you screenshotted in your message). It also might be helpful to see your package.json for debugging purposes.



Cheers,


Billy


Hi Billy,



Thanks for getting back to me.


It’s not something related to Airtable SDK. I somehow solved it by deleting my node_modules folder and running yarn install again :man_shrugging:


Hi Billy,



Thanks for getting back to me.


It’s not something related to Airtable SDK. I somehow solved it by deleting my node_modules folder and running yarn install again :man_shrugging:


Ahhh, classic stale dependencies. Glad you solved the issue!


Reply