#Why does calling this.model.save() rerender page

1 messages · Page 1 of 1 (latest)

smoky smelt
#

I'm saving my model and the page is re-rendering which is breaking my page because the data isn't mapped properly yet. So the data passed to the component is undefined.

smoky smelt
#

@south vault question. When I load my page I setup my data to be a trackedObject... after I save it.. i have a function to make it a tracked object again but it's not showing up like that

tender wadi
#

Rather than creating a new tracked object can you update the contents of the existing one?

smoky smelt
#

For what ?

tender wadi
#

To try to avoid the page re-render.

Can you share some code?

smoky smelt
#

I think I figured it out

south vault
#

can you show code?

#

oh! glad you figured it out!

smoky smelt
#

yeah I'm like 99% sure I figured it out and it was something I was doing

#

give me one second i'll explain

smoky smelt
#

Bunch of things I was doing a few things wrong

  1. setupController()
    Not sure why its implemented if it's bad but it bad if your doing dynamic stuff on the page.. I use it in a few place that i suspect I'm doing wrong ... but unless

  2. using this.model.some_array_property instead of a get use_this_function_to_get_data because the first one wasn't getting the click events to fire again, and the data isn't the same after model loads if use setupController, or you need your data in a certain way before it's handed to the data.

For instance I need to add a delete property on an object that I'm not going to save in the databse as it's only for editing.. when I did it in my setupControler it worked the first time but after the this.model.save() but after the click event stop firing. Then I moved it to model() in my route and did the same thing, but doing it as the get function worked.

smoky smelt
#

let me know if I confused you or anything

#

Also using TrackedArray vs A() I think also helped

south vault
#

yea, setupController is always bad -- it only still exists because no one has written a deprecation guide for it yet -- and we're kinda not wanting t odeprecate any of the existing routing system until we havee a replacement one that folks can use instead of the what-would-the-be-deprecated-ais

#

yea, A() is trying to be deprecated by @bitter shuttle , I think

smoky smelt
#

yeah .. I think that's the problem react has... "We can't depercate it until we find somthing better" .. sometimes something better is just better code else where lmao

#

setupController is a flook ass function

#

fluke*

#

and the depreciation guide looks like this

bitter shuttle
#

Yeah, some day we'll deprecate A. I just need to find time to do the work.

#

It's definitely doable

south vault
#

and hopefully we'll do it before the next routing system ships lol

smoky smelt
#

yeah ... well what ever ya throw at the world Im' going to use...

#

As frustrated as I get at times... its been 100% my fault at all times which is what I love lmaoo

#

I hate having to fight with the framework because of nuances..

#

and I've been leaning into JSON:API and now all my errors are dynamic... and working with all form-fields. Probably been the best upgraded I've added so far

#

I have to do a web accessbility audit before April 26th 2026 for to comply with federal goverment standards...

#

So it's been a big overhaul LOL and with all the new stuff I learned it has helped .

south vault
#

Excite!