# How to update the buffered attributes from within a Glimmer Component attached to edit-topic

**URL:** https://meta.discourse.org/t/how-to-update-the-buffered-attributes-from-within-a-glimmer-component-attached-to-edit-topic/348831
**Category:** Development
**Created:** [January 24, 2025, 3:42pm UTC](https://meta.discourse.org/t/how-to-update-the-buffered-attributes-from-within-a-glimmer-component-attached-to-edit-topic/348831 "2025-01-24T15:42:33Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [January 24, 2025, 3:42pm UTC](https://meta.discourse.org/t/how-to-update-the-buffered-attributes-from-within-a-glimmer-component-attached-to-edit-topic/348831/1 "2025-01-24T15:42:33Z")

</div>

This is the old template I’m trying to elminate and move it to a Glimmer Component

```plaintext
{{#if model.showLocationControls}}
  {{add-location-controls
    location=buffered.location
    categoryId=buffered.category.id
  }}
{{/if}}

```

Lower down, there is simply a ` this.set("location", location);` which appears to exhibit two way binding.

This works fine.

Accessing the buffer with `buffered` provides the necessary connectivity to pass up changes to location.

The challenge comes when when using a replacement Glimmer Component:

```plaintext
export default class EditLocationDetails extends Component {

  @action
  updateLocation(location) {
    this.args.outletArgs.buffered.location = location;
  }

  <template>
    {{#if this.args.outletArgs.model.showLocationControls}}
      <AddLocationControls
        @location={{this.args.outletArgs.buffered.location}}
        @category={{this.args.outletArgs.buffered.category}}
        @updateLocation={{this.updateLocation}}
      />
    {{/if}} 
  </template>
}

```

Now the attribute can be updated, but it doesn’t stick, presumably as its a data down Glimmer argument.

What am I missing?

Is there an action I can access that allows me to pass up the change?

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [January 24, 2025, 4:24pm UTC](https://meta.discourse.org/t/how-to-update-the-buffered-attributes-from-within-a-glimmer-component-attached-to-edit-topic/348831/2 "2025-01-24T16:24:27Z")

</div>

OK this is what I appear to be missing.

Exploring the Object I found a few interesting attributes, so this action becomes:

```plaintext
  @action
  updateLocation(location) {
    this.args.outletArgs.buffered.buffer = {
      location: location
    }
    this.args.outletArgs.buffered.hasBufferedChanges = true;
  }

```

That seems to do it.

Almost none of that was immediately obvious.

Please let me know if there’s a better way of doing this.

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [January 24, 2025, 8:44pm UTC](https://meta.discourse.org/t/how-to-update-the-buffered-attributes-from-within-a-glimmer-component-attached-to-edit-topic/348831/3 "2025-01-24T20:44:24Z")

</div>

There’s a more elegant way of doing this and presumably this is more standard and intended:

```plaintext
  @action
  updateLocation(location) {
    set(this.args.outletArgs.buffered, "location", location);
    this.location = location;
  }

```

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [February 23, 2025, 8:45pm UTC](https://meta.discourse.org/t/how-to-update-the-buffered-attributes-from-within-a-glimmer-component-attached-to-edit-topic/348831/4 "2025-02-23T20:45:13Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
