Flame - Automatic Saving for JSON Data

My Ember Data model needs to be autosaved whenever any of its fields change. Although I have been using the autosave plugin, it doesn't work properly with JSON fields.

The model's fields are structured like this:

title: DS.attr('string'),
options: DS.attr(),

Changing the title attribute triggers the setUnknownProperty method in the ObjectProxy used by the plugin, but changing subfields like options.layout does not. This means those changes do not trigger autosave.

I attempted setting observers on all properties within the options object as a workaround. However, when the model is saved and reloaded from the server, it causes an endless loop as the observers fire again upon reloading.

What other solutions can I explore in this situation?

Answer №1

Imagine you tried

settings.design = 'baz';

And right away executed:

  this.put('settings', settings)

Would this activate the updateProperty function in your custom Proxy?

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Modify the indentation format in CSS/JS

When the Tab key is pressed in an HTML page and the tabbed link gets highlighted, is it feasible to customize the style of that highlight? ...

Getting the name and value from an object

Just starting out with Javascript and Nodejs, using express and making a call to the following link: localhost:7080/v1/movies/order/notify/insert?breed=Whippet&age=10 After that, I am attempting to extract the property name along with its correspon ...

"Refreshing the page is the only way to get the JavaScript image

I'm currently facing a frustrating issue with my game engine. The images are not loading correctly on the initial page load, forcing me to refresh the page every time. Here's the current code snippet that I'm working with: Texture creation: ...

Guide to constructing a multi-dimensional array using dynamically generated fields and variables

Here is the URL that I wanted to share with you: All the fields visible on this page are generated dynamically from the backend. To display the pricing, I used the field names as variables in the JavaScript below. However, I encountered two issues - first ...

From MS SQL to ASP.NET to JSON: The evolution of data manipulation

Is there a way to transform backend data into a JSON response using .NET technologies? It would be beneficial to have this functionality and utilize jQuery to retrieve information from the backend. ...

Import a Blender Animation into Three.js with the Three.js JSON exporter

Currently, I am taking my first steps in JavaScript and exploring Three.js as well. One of the things I am learning is how to export and load a Blender animation into Three.js. To help me with this process, I am using an example from the Three.js website: ...

Error in TypeScript on SendGrid API: Invalid HttpMethod

Here is my code snippet: import sendgridClient from '@sendgrid/client' sendgridClient.setApiKey(process.env.SENDGRID_API_KEY); const sendgridRequest = { method: 'PUT', url: '/v3/marketing/contacts', bo ...

I'm facing an issue when trying to convert a string to JSON in Ionic2

When attempting to retrieve json in the code below, an unexpected "space" is present after the opening brace and before the closing one: { "address": ......, "filename": image.png, "price": 12 } If I use res.json() in the following code, it result ...

Vue.JS is throwing a TypeError: Unable to employ the 'in' operator to look for 'undefined' within the Laravel Object

How can I successfully pass an object from Laravel to Vue.js and utilize it in a v-for="option in this.options"? Although I am able to transfer the object from my Laravel blade to the Vue.js component and view it in the console, I encounter an error when a ...

Guide for extracting data from an external JSON file in a .jsx file

Looking for assistance with parsing a JSON file in React. I am working on a PerfCompare.jsx file where I need to extract a variable from an external JSON file (trscConfig.JSON). Whenever I try to parse the variable using the code below, I encounter a Synta ...

Getting the value from a nested object in Swift

My challenge involves accessing a value within a nested object, which basically consists of an array containing objects where one of the objects contains other objects as values. (result, response, error) -> Void in if let err = error { ...

Developing with Cordova involves collaborating with PHP and MySQL for efficient and seamless

As a newcomer to the world of cordova, I am currently in the process of familiarizing myself with its syntax. At this stage, I have manually inputted some json data and developed an application. In this app, when a user chooses a serial number from a dropd ...

Issue: "TypeError: Unable to retrieve dynamically imported module" encountered while utilizing dynamic imports in Remix application

I am currently facing an issue with dynamic imports in my Remix application. Whenever I try to dynamically import a module using the code below: const module = await import(../lib/lang/lang-${language.toLowerCase()}.js); An error occurs: TypeError: Fail ...

Obtain the HTML5 data attribute from an event directly in the code

I am attempting to access the data attribute in the following manner (my doctype is html5): <a href="#my-link" data-zoom="15" onclick="alert(this.data-zoom); return false;">link</a> However, I am encountering an e ...

Leverage jq to combine keys that share the same identifier

Imagine having two JSON files: 'b.json' and 'a.json'. [ { "id": 3, "foo": "cannot be replaced, id isn't in a.json, stay untouched", "baz": "do not touch3" }, { "id": 2, "foo": "should be replaced with &ap ...

Is there a way to navigate to the home page using a PNG icon without refreshing the page when clicked on, while also utilizing NavLink with a route of '/'?

Here's the code I'm working with: <div key="1" className="menu-item"> <NavLink to="/"> <span className="icon-home3" />&nbsp; Home </NavLink> </div> The Home button functions ...

Using AJAX in a Django application within a RESTful ecosystem

I am new to the world of restful programming and have a Django website. My goal is to dynamically load a part of the website. Currently, my workflow is as follows: When I call a URL (such as localhost:8080/index), it routes to the Django view, which retr ...

Is there a way to efficiently use AJAX and PHP to iterate through JSON data and save it to a new JSON file

I have created a simple movie editor with a sidebar where users can drag and drop elements. On the right side, users can edit these elements as they wish and save the data to a JSON file. When the user clicks save, I want it to create a new file and save t ...

Navigational link behavior in the React component with the <tr> element

I am in the process of developing a React application with a component that shares a resemblance to the following: class TableRow extends React.Component { constructor(props) { super(props) } render() { const handleClick = () ...

bridging information from tables with text fields in forms

I am working on an HTML/CSS page that utilizes a table layout filled with buttons to mimic a T9 keypad design. Within the page, I have a form containing two text fields. My aim is to populate these text fields with numbers based on the values from the tab ...