Jun 28, 2020 11:50 PM
i have button to add record. before release , in development ,was able to add record from custom block succesfully with `table.createRecordAsync’ . when block is released does not add new record. block is started on terminal
Jun 29, 2020 11:41 AM
Can you add a screenshot (including the browser console) to share any errors when your released block tries to create a record?
Jun 29, 2020 04:45 PM
attached .
Jun 30, 2020 02:08 PM
Is there any error inside the block or in the developer console after you click “Add marker”?
Jun 30, 2020 04:32 PM
No error in block or console .
Jun 30, 2020 07:33 PM
Hm, this is going to be tricky to figure out without seeing the code of the block. If this is an open source block, can you link to the repo? Otherwise can you paste the relevant files (i.e. the component that has the “Add marker” button and the onClick handler code)
Jul 01, 2020 02:39 AM
Adding on to Kasra’s suggestions: one common cause of the “it works in development, but not after releasing” is that you’re relying on globalConfig
values that were set in development, but haven’t been set in the release block yet (they have separate globalConfig
stores).
This seems like it might be happening here since your omdbApiKey
is undefined - is it stored in globalConfig
?
To test this theory, you can clear your globalConfig
in development from the block developer tools and see if the same issue occurs.
There’s more details in this previous forum thread and the “Polishing your block” guide.
Jul 01, 2020 07:29 PM
yes found the issue i was missing id in airtable ui buttons. i got to fix by reverting to regular input button
function AddForm(props) {
const [name ,setName] = useState()
const [seaty, setSeatY] = useState()
const [isDialogOpen, setIsDialogOpen] = useState(false);
const base = useBase();
const table = base.getTableByName('Markers');
const records = useRecords(table.selectRecords());
async function handleSubmit(e) {
const errors = {};
e.preventDefault()
if (!name){
// setName(“required”)
return ;
}
try {
//save record
table.createRecordAsync({‘Name’: name, ‘X’: seatx, ‘Y’:seaty});
// marker
} catch (e) {
console.log('error',e);
}
setName("")
setSeatX("")
setSeatY("")
}
const handleSaveMarkerClick = () => {
setIsDialogOpen(true)
}
// const addRecord = (record, recordFields) => {
// if (table.hasPermissionToUpdateRecord(record, recordFields)) {
// // table.createRecordAsync(recordFields);
// }
return (
{isDialogOpen && (
<Dialog onClose={() => setIsDialogOpen(false)} width="320px">
<Dialog.CloseButton />
<Label htmlFor="my-input"></Label>
<form onSubmit= {handleSubmit}>
<legend>Add New Marker</legend>
<div className="form-group">
<Input value={name} onChange={e => setName(e.target.value)} id="Name" type="text" placeholder="Name" />
<label> Seat</label>
<Input value={seatx} onChange={e => setSeatX(e.target.value)} id="seatx" type="text" placeholder="X" />
<Input value={seaty} onChange={e => setSeatY(e.target.value)} id="seaty" type="text" placeholder="y" />
<Button
icon="edit">Add marker </Button>
</div>
</form>
<Button onClick={() => setIsDialogOpen(false)}>Close</Button>
</Dialog>
)}
</div>
)