presciencelabs / tabitha-editor

0 stars 0 forks source link

Move token checking process to server-side #97

Closed craigp-atw closed 3 months ago

craigp-atw commented 4 months ago

Moved tokenize and checking process to the server-side. Converted to an API call that returns an array/structure of tokens. image

Added 'Check' button to prevent constant API requests. image

cloudflare-pages[bot] commented 4 months ago

Deploying editor with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2078b61
Status: ✅  Deploy successful!
Preview URL: https://a01466b4.tabitha-editor.pages.dev
Branch Preview URL: https://move-tokenization-to-server.tabitha-editor.pages.dev

View logs

longrunningprocess commented 3 months ago

after further thought and a little research, I guess the trade-off on the async pipe is to either have two separate calls or a condition inside the one that will determine whether it received a Promise or not. If you don't foresee a situation where the sequence of an async call and sync call don't conflict, then this solution will work but putting the condition inside pipe will help avoid such a conflict should it arise in the future.

craigp-atw commented 3 months ago

after further thought and a little research, I guess the trade-off on the async pipe is to either have two separate calls or a condition inside the one that will determine whether it received a Promise or not. If you don't foresee a situation where the sequence of an async call and sync call don't conflict, then this solution will work but putting the condition inside pipe will help avoid such a conflict should it arise in the future.

I had tried only using the async pipe, but it caused a function in case_frame to fail (see below), because it returned a Promise instead of the expected value. I could have changed check_case_frames() to become async, but that would have an unnecessary ripple effect throughout the whole rule system. image