3 ms·
There were a few places where the compiled down JS to Imba was a bit hard. But when it got tricky I could just compile that single file and see the results. Ove
by ishanr 4y ago
There were a few places where the compiled down JS to Imba was a bit hard. But when it got tricky I could just compile that single file and see the results. Overall it was pretty straight forward but also my app is pretty simple.
And here is one of the components:
import supabase, { UNIQUE_VIOLATION_CODE } from '../constants'
import normalizeUrl from 'normalize-url'
import './links-list'
tag pad-page
loading = false
links
err\string
newUrl\string
def routed
fetchLinks!
def fetchLinks
loading = true
let {data, error} = await supabase.rpc('select_links_from_pad', { pad_id_input: route.params.id })
.order('created_at', {ascending: false})
loading = false
if error
log error.message
return
links = data
imba.commit!
def addLink
if newUrl
const {data, error} = await supabase.rpc('insert_link_into_pad', {
pad_id_input: route.params.id,
url_input: normalizeUrl(newUrl, {defaultProtocol: 'https:'})
})
if error..code == UNIQUE_VIOLATION_CODE
err = 'link already added'
setTimeout(&, 3000) do
err = ''
imba.commit!
elif error
return
newUrl = ''
links.unshift(data)
<self>
<div[mt:5]>
<label[mr:3]> 'add a link'
<input
[bg:red4 c:white]=err
type='url'
bind=newUrl
@keydown.enter=addLink
>
<button[ml:1] @click=addLink> 'Add'
if err
<p[c:red5]> err
<links-list loading=loading links=links>
- yetanother12345 4y agoI hope this console error message will be helpful to you, as it wasn't really for me: The resource from “https://shynet-lhkb.onrender.com/ingress/f29fe2d5-5f78-456e-9a4c-0202536da148/script.js” https://shynet-lhkb.onrender.com/ingress/f29fe2d5-5f78-456e-... was blocked due to MIME type mismatch (X-Content-Type-Options: nosniff). Also, console reports another issue: SyntaxError: invalid regexp group client-SMJMSZTC.js:2:145487 FYI, the sudopad.com domain unfortunately displays nothing at all in my browser.
- yetanother12345 4y agoadded: it seems the error may be with the framework "lmba" that you are using as the console reports these (other) issues at the lmba.io page (which also returns completely blank): unreachable code after return statement[Learn More] index-LZXNJ15B.js:16:21954 TypeError: window.customElements is undefined[Learn More] index-LZXNJ15B.js:8:23994 But thanks for the idea, I might like to code something similar without using frameworks. I still miss the del.icio.us thingamajig sometimes
- deleted 4y ago[deleted]
- ishanr 4y agoInteresting. Can you kindly let me know your browser and os?
- yetanother12345 4y agoSure, no prob. I belive I was using a somewhat niche browser on an old 32 bit machine, which could be out of the scope for what you would like to support :): User Agent: Mozilla/5.0 (X11; Linux i686; rv:68.0) Gecko/20100101 Goanna/4.8 Firefox/68.0 PaleMoon/29.4.0.2 (I'm certainly not requiring that you should support such niche tech, it's just a very old laptop that has a better form factor than my more recent ones, so I tend to prefer it for various situations)
- ishanr 4y agoOh that is actually shynet self hosted analytics which is privacy friendly. https://github.com/milesmcc/shynet https://github.com/milesmcc/shynet But I think I'll just remove it for now. Update: removed