PricingBlog

My editor is lagging really bad, i can barely do anything.

  • iconic4213-1473271512881561744

    Iconic

    24 days ago

    Been out of nordcraft for a while came back to build a new project and for some reason the editor is lagging, its so bad ihad to rework my whole api systemand its still lagging. what could be the issue?
  • whitep4nth3r-1473282427240710237

    salma

    24 days ago

    do you have any issues in the issues panel?
  • erikbeus-1473282887548666038

    Erik Beuschau

    24 days ago

    It could be a number of things really:
    - The size of your project
    - The number of elements in the component/page you have opened
    - Slow custom actions that perform unnecessary work
    - Large (1MB+) test values for attributes
    - Big API responses
  • iconic4213-1473282987176104009

    Iconic

    24 days ago

    nope
  • iconic4213-1473283053378867235

    Iconic

    24 days ago

    its just one page i started with,
  • erikbeus-1473283195708506112

    Erik Beuschau

    24 days ago

    Sounds strange. Could you share a url to your project? DMs are open
  • iconic4213-1473283340193894422

    Iconic

    24 days ago

    yeah i noticed a larger response crashed the editor, but then what's the way around that.
  • erikbeus-1473283606079078573

    Erik Beuschau

    24 days ago

    Large API responses don't necessarily crash the editor. But if you're doing heavy processing of the response (filtering, modifying it etc.) the runtime might start to struggle.
  • iconic4213-1473283904789024872

    Iconic

    24 days ago

    i wasnt even doing anything. It crashed it
  • iconic4213-1473284195177595107

    Iconic

    24 days ago

    i had to rebuild the whole api setup i had and still it lags but doesn't crash anymore, but when im pulling a large data it does
  • erikbeus-1473284432239788175

    Erik Beuschau

    24 days ago

    Which API call do you believe makes it slow?
  • iconic4213-1473286063320465450

    Iconic

    24 days ago

    the main one getting a product and its prices and they're all text data that im then storing in a variable
  • also worried about moving these functions to the backend because constant api calls cause lags
  • erikbeus-1473287662944125041

    Erik Beuschau

    24 days ago

    From the URL you provided, the API responses don't look very big.
    Generally, it's rarely necessary/beneficial to store API responses in variables. Instead, it's usually better to access the data directly from the API response. That way, the UI will also update if the API call is re-fetched later.
    When I open the editor on your start branch I don't experience any lag. Not sure if any logic on the page would work differently for you than others? (perhaps if you're using some sort of authentication)
  • iconic4213-1473287900140539914

    Iconic

    24 days ago

    thats because i switched to a really small, product.
  • Tod-1473287902455664650

    Tod

    24 days ago

    Great job @Iconic! Your contribution to the Nordcraft Community just made you advance to Community Level 2! 🌲
  • iconic4213-1473287959695458354

    Iconic

    24 days ago

    if i switch to a larger product now it would lag
  • theres a variable called current_product_id switch it to 9 and the lags starts
  • erikbeus-1473288618335404172

    Erik Beuschau

    24 days ago

    I'll check
  • erikbeus-1473289568563495045

    Erik Beuschau

    24 days ago

    It still doesn't lag on my end 🤔 Could you perhaps create a screen recording of the issue you experience?
    A few things I would try:
    - Remove the unused variables (see the issues panel on the left)
    - Stop saving API data in variables and reference the API data directly
    - Don't start your API calls in the onLoad workflow - instead, just set the API requests to auto fetch
  • iconic4213-1473289571583262800

    Iconic

    24 days ago

    sorry i meant 6
  • iconic4213-1473289706614558864

    Iconic

    24 days ago

    auto fetch made it way worse. it crashed constant ly
  • erikbeus-1473289711744188681

    Erik Beuschau

    24 days ago

    Ah, now I see it 👍
  • iconic4213-1473289869487898836

    Iconic

    24 days ago

    i use those variables to segment data properly so i can display and calculate it
  • iconic4213-1473290189962088530

    Iconic

    24 days ago

    as i changed it now its crashed on my end
  • erikbeus-1473290517847736464

    Erik Beuschau

    24 days ago

    Right. But I believe you could achieve the same using formulas that work with the dynamic data from your API responses.
    Your product_variant_attribute_data API returns a response of 789,142 lines (for current_product_id=6). That seems like a lot of data 🤔 It might be useful if you could filter some of the data on the server.
  • iconic4213-1473291984952234157

    Iconic

    24 days ago

    but regardless when i run a smaller data like the one with the smaller id it still lags
  • erikbeus-1473292477116059711

    Erik Beuschau

    24 days ago

    Which id is that? Just so I can try on my end?
  • iconic4213-1473292943547699201

    Iconic

    24 days ago

    the 9
  • erikbeus-1473293834808070227

    Erik Beuschau

    24 days ago

    I'll check if I can find the root cause for this and get back to you
  • jacobkofoed-1473332381548286015

    Jacob Kofoed

    24 days ago

    I am currently having a look at this. I think we can optimise things quite a bit from our side, but I would still follow all of @Erik Beuschau's suggestions as keeping things small will help a lot.
  • iconic4213-1473334756971254026

    Iconic

    24 days ago

    worse issue, acceepeted an ai logic thati thought was going to improve an api call, instead it deleted elements and api and a whole other functions and the editor crashed , reloaded and now i can undo the changes
  • jacobkofoed-1473337009861820681

    Jacob Kofoed

    24 days ago

    Sounds really bad. The AI is still receiving updates daily, so issues are expected for a little while. However, in your version history sidebar there’s a new feature to go back to a previous commit. You can use it to go back to where you were on your branch.
  • jacobkofoed-1473664790021800110

    Jacob Kofoed

    23 days ago

    I released some changes that should make things run a lot better. There are still some more we can do to improve editor-performance, but as always keeping components small will always make things faster.
    👍1