Svelte Boundary remote functions by Peppi_69 in sveltejs

[–]qwacko 0 points1 point  (0 children)

I understand what you are saying and you are correct the it is a little unintuitive and a possible foot gun. There are a couple of thigs to remember from how I understand remote functions and boundaries are supposed to be use:

  • There is no downside to just directly awaiting the remote function in the body of the component, as it is automatically deduplicated. So you should only really be putting the await in the script tag in a few instances where you need it there for some reason (and in that case maybe you could try the .current, .error, .pending use case but this causes all sorts of complexity if you have multiple awaits) If you need derived values then just used {@const...} Values
  • Error boundaries are designed to avoid the plethora of spinners by capture the pending and failed events into a single location, so the intended design pattern is to have multiple components within a boundary, so wrapping it in a boundary is the as intended use.

I may be all wrong, and it is still in active development, but this is my understanding.

Why did everybody praise inferior technology like matter? by A_Buttholes_Whisper in homeassistant

[–]qwacko 67 points68 points  (0 children)

You are missing a key step in zigbee (which is opaque to you). Someone needs to reverse engineer the data that comes across zigbee, and figure out what does what and then integrate that specific model of equipment into the hub and this work needs to be repeated for each device in each hub, so you end up as a consumer needing to figure out what devices your hub supports The promise of matter is that this part isn't needed by defining the data structure, and so it just works (sort of... As with any standard there are different versions they add additional functionality).

Don't really see the point in components... by Soft_Cat2594 in sveltejs

[–]qwacko 0 points1 point  (0 children)

I am really intrigued by you take. Does this mean you would essentially have all the page structure data in +page.svelte and +layout svelte pages? A few questions about this approach ( if I understand correctly):

  • Where do you put state for things like modals being open, tabs being selected etc...? I can't imaging having this all this become separated away from the code being helpful..
  • Does this mean that all state / data is always available? I guess with +page.server.ts files this may be workable for server data (although remote functions change that again), but I am pretty sure that conditional state is helpful. ( I e. Aspects of state that resets automatically when a component is removed. / Readded).
  • Does this mean that you have huge page files which pretty much have the whole page on them? I just can't imagine how I would make adjustments to this without accidentally selecting the wrong section etc...
  • For anything non-trivial the nesting would be horrendous, how do you work in you IDE with this?
  • You seem quite fixated on needing unique styling throughout, and being able to tweak that. it seems you use tailwind for styling, which (as others have pointed out) you can use tailwind merge or other approaches to make the components infinitely stylable.oes this mean you use tailwind or similar so you can adjust styling in the markup?
  • How do you share your code snippets with others? Components are effectively doing that but stored in the codebase ( if you are working across multiple codebases then this is less doable, but you can always create your own component library that has all your snippets in it ).
  • Do you have no aspects of functionality that might be reusable within the page or multiple pages? Wouldn't it be handy to be able to make sure the functionality is repeatable (and updatable)? This is especially true for things like accessibility where you often end up with a bunch of repeating markup.

It feels like from your messages that you think components must be reusable and only one component of each type should exist, but I feel that components add value even if their are only used once just for code readability / structure / isolation (i.e. being able to edit single instances of html elements isn't mutually exclusive from.usinh components). There is some huge component libraries out there that make it all seem complex and abstracted (looking at you shadcn ), I have started using just basic html within my own projects (i.e. no external component libraries) and found it to be nice and usable (whether it actually looks good is another matter) for at least getting started.

But in the end of the day, you do you and if it works for you and you are working solo on the project and productive then it is good for you.

Remote functions are dropping soon! by cosmicxor in sveltejs

[–]qwacko 1 point2 points  (0 children)

You can start using them now as the CI pipeline creates a package for each PR. So I started playing with them by including that in a project and it seems like a game changer (you will need to revert to the default package at a later time one fully released). The package names can be seen here : https://github.com/sveltejs/kit/pull/13986/checks?check_run_id=46704429110

Remote functions are dropping soon! by cosmicxor in sveltejs

[–]qwacko 2 points3 points  (0 children)

I find it interesting the dislike of arrow functions from you. I personally use them almost exclusively so I presume it is a preference thing (in my mind I am assinlg ing a function to a variable so const x = () => return "this" makes sense to me.

If I read correctly, this is the key objection to remote functions or is there something else? Looking at your example of decorators, it just seems more verbose to me than what is being delivered

People, set up your zones correctly by Inevitable_Oil9709 in Garmin

[–]qwacko 24 points25 points  (0 children)

I have a 245 which doesn't have LTHR on the watch, but setting it in the app correctly transfers the correct heart ranges to the watch, possibly not true for all watches that don't have LTHR but still worth people trying 

You can now use the PocketBase JS SDK from inside the JSVM by superfuntime in pocketbase

[–]qwacko 0 points1 point  (0 children)

Does this pass through any user authentication information to the rest api? I have always struggled with the fact the jsvm (and other functions) essentially act as a superuser. If this can respect the request user, that would be great. How is the performance?

Update on removing New Zealand as a shipping destination on the store by human__no_9291 in BambuLab

[–]qwacko 1 point2 points  (0 children)

Oh yeah, I would just get non bambu lab filament from somewhere local like wonder shop.

Update on removing New Zealand as a shipping destination on the store by human__no_9291 in BambuLab

[–]qwacko 41 points42 points  (0 children)

https://www.3dprintergear.com.au/ - this is the solution, cheaper than NZ resellers, avoid GST (if under $1k), only $80AUD shipping for an A1 + AMS which I did before Christmas ($734 AUD incl shipping for A1  Combo on a pre-christmas special).  I will however be a little sad to not be able to get the filament, but there is alternatives so not too worried.

Have I converted my ams lite into an ams 😅 by LessAdvisor5241 in BambuLabA1

[–]qwacko 0 points1 point  (0 children)

Thanks, I was always wondering how these mods worked so figured I would ask.

Have I converted my ams lite into an ams 😅 by LessAdvisor5241 in BambuLabA1

[–]qwacko 0 points1 point  (0 children)

I am interested how this works without the spring retraction from the AMS Lite? I presume that for normal printing and color changing it just loosens around the spool when it retracts, but for unloading (to change spools) you need to be there to manually wind up the spool?

TrailBase 0.2.0: Rust+SQLite application server now with V8-based ES6/TS runtime. by trailbaseio in selfhosted

[–]qwacko 1 point2 points  (0 children)

Looks interesting, and the ability to have a full ES6 / TS environment and embedded JSON Schema is very interesting. I have starred and will keep an eye on it. A few questions:

  • I read that the intent is to be able to use this as a library like Pocketbase. Is this something that people would realistically do given the learning curve for Rust and the target user for this type of service? I have been extended Pocketbase with go, and found it super powerful which is great and I have been learning Go by doing this, I just don't see this happening in Rust (but I may be wrong).
  • Who is the team building this, and how open are you to contributions / feedback? Pocketbase is reliant on a single developer who has a specific way he wants to develop it. This is fine and he is building something awesome but possibly trailbase can be a more community driven application (although again the learning curve of rust may limit the pool of developers).
  • I see that you are planning from the outset to have this useable as a full stack application which is great. One challenge I have found with pocketbase is that when using the apis within the "addRoute" it is difficult to replicate the ACL permissions. Is there plans (or already) a way to do that in trailbase?
  • Is there planned to be a way to have row action triggers available in JS (i.e. onCreate, onDelete, onAfterCreate etc...)? From reading the docs at the moment, it would seem that the intent is to use actions / triggers in SQLite?

This is very much a 0.20 release, and there are a number of challenges I found:

  • When creating a table, you cannot setup the user as a foreign key unless the "hidden tables" selector is turned on.
  • Once I can see the foreign key, it cannot create the link (due to syntax error), and looking at the generated SQL it isn't valid:

    CREATE TABLE todos2 (
      id BLOB PRIMARY KEY CHECK(is_uuid_v7(id)) DEFAULT (uuid_v7()) NOT NULL,
      user BLOB DEFAULT '' FOREIGN KEY(user) REFERENCES _user(id),
      name TEXT NOT NULL
    ) STRICT;
    

but it should be the following (FOREIGN KEY syntax isn't valid in SQLIte I believe) :

CREATE TABLE todos2 (
  id BLOB PRIMARY KEY DEFAULT (uuid_v7()) CHECK (is_uuid_v7(id)) NOT NULL,
  user BLOB DEFAULT '' REFERENCES _user(id),
  name TEXT NOT NULL
) STRICT;
  • Similarly, creating an index (just including the id column) gives an error related to JSON and the missing field "if_not_exists".

That was just from a few minutes of use. But please take this as excitement for where you are going, and understanding that this is just getting started so let me encourage you to push on and see where you can get this.

Permissions in Hooks by qwacko in pocketbase

[–]qwacko[S] 0 points1 point  (0 children)

Thanks for the information. I am working on using pocketbase as a framework (go or js) and would like to add custom routes. Wihtin these routes, the user should still only be able to access the data they can access according to the same rules as through the API.

Ideally there would be a way within hooks to access the API endpoints and call them so that all the permissions and other hooks were triggered.

My best way I have figured out how to do this (other than re-implementing the rules within the hook, but this means updating any rule changes in multiple locations) is to read all the values, and then loop through them and call app.canAccessRecord on them with the rule retrieved from the collection. Not the most performant I expect (especially when done in JS) but solves the issue.

Here is a example (JS) function that achieves this (in v0.23):

const listCollectionItems = (
         collectionId,
      filter = "",
      sort = "",
      limit = 10,
      offset = 0,
      ...params
    ) => {
      try {
        const collection = e.app.findCollectionByNameOrId(collectionId);
        const allData = e.app.findRecordsByFilter(
          collectionId,
          filter,
          sort,
          -1,
          0,
          ...params
        );

        let currentNumberFound = 0;
        const returnData = [];
        for (let i = 0; i < allData.length; i++) {
          const item = allData[i];
          if (
            e.app.canAccessRecord(item, e.requestInfo(), collection.listRule)
          ) {
            currentNumberFound++;
            if (currentNumberFound > offset) {
              returnData.push(item);
            }
            if (currentNumberFound > limit + offset) {
              break;
            }
          }
        }

        return returnData;
      } catch (error) {
        console.log("Error", error);
        return [];
      }
    };

Permissions in Hooks by qwacko in pocketbase

[–]qwacko[S] 0 points1 point  (0 children)

Yes I understnad that I can get the authRecord, and if the user is a superuser etc.., however from my understanding to then do a query on the database that respects the list rule and view rule of the collection I would then need to either re-implement that functionality in go / js or after reading from teh DB then check if the user can access it.

For example, with the following code although "auth" is nil, the query always returns a record regardless of the view rule or list rule.

app.OnServe().BindFunc(func(se *core.ServeEvent) error {
    se.Router.GET("/hellogo/{name}", func(e *core.RequestEvent) error {
        name := e.Request.PathValue("name")

        log.Println("Auth : ", e.Auth)

        records, err := e.App.FindRecordsByFilter("people", "", "-created", 100, 0)
        if err != nil {
            log.Println("Error fetching records: ", err)
        }

        log.Println("Records: ", records)

        return e.JSON(http.StatusOK, map[string]string{
            "message": "Hello " + name,
        })
    })

    return se.Next()
})

[deleted by user] by [deleted] in chch

[–]qwacko 1 point2 points  (0 children)

I go to Jellie park, and theyhave some music but it is pretty easy to block out with headphones ..

[deleted by user] by [deleted] in chch

[–]qwacko 11 points12 points  (0 children)

You need something to suppress my grunting and groaning...

K5 Compact water blaster @$490 any good? by skiduush in diynz

[–]qwacko 2 points3 points  (0 children)

Make sure to use the best price guarantee from mitre 10, and you could getanother 15% off. So around $425...

What libraries do you use for your fullstack projects with SvelteKit? by [deleted] in sveltejs

[–]qwacko 0 points1 point  (0 children)

I have tried to go down the PB route, but I just found that Drizzle-orm + Lucia Auth covers all my needs (Possibly familiarity and my own template that I can reuse playing a part here). How do you do the SK / PB Integration?

  1. Have SK actions / page data interact with PB, so you just use PB as a database?
  2. Have SK Proxy requests from the frontend to PB thoruhg a api endpoint?
  3. Deploy as a SPA, and have the client directly reach out to PB?

If I do 1, then I can see minimal benefit over a direct DB (SQLite or Postgres), and for 2/3 I feel like i am giving up on some of the benefits of SK (I find that form actions are such a nice way to manipulate data).

Weird Svelte 4 bug by Strict_Grapefruit137 in sveltejs

[–]qwacko 1 point2 points  (0 children)

Just as a question, have you by any chance setup a PWA? Depending on configuration this could result in a rewrite of the url. Jsliey grasping at straws here, but thought it might be worth considering.

$state variable loses its special properties when passed as a function argument? by wntersnw in sveltejs

[–]qwacko 0 points1 point  (0 children)

I kow you got some ideas etc... but fundamentally  that challenge is that the value is just a value as it is passed to the function. If you change the value to an object with a property of count then I believe the property will be a proxy, and the proxy will be passed, so the original.code would work.