Skip to content

Conversation

@patricklx
Copy link
Collaborator

Description

some computed properties are not interacting well with tracked array
fixes #2690

Screenshots

@mansona
Copy link
Member

mansona commented Oct 7, 2025

I would prefer to see this change being made to fix a failing test 🙈 CI passing before and after this shows that we have a gap in our testing here. Probably another thing that is blocked on having a good separated test app.

@patricklx
Copy link
Collaborator Author

@mansona I now added a failing test and ci showed also the error. then I pushed the fix

export default class StorageService extends Service {
@service(LOCAL_STORAGE_SUPPORTED ? 'storage/local' : 'storage/memory')
declare backend: LocalStorageService | MemoryStorageService;
@tracked changed = 1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@patricklx this whole system of manually updating changed to indicate something changed seems wrong to me. We should be working from derived state and use normal tracking things.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's to make local storage tracked

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just saw that you have a more sophisticated implementation:
https://github.com/adopted-ember-addons/ember-tracked-local-storage/blob/master/addon/utils/tracked-local-storage.js
:)

But maybe its not really necessary?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and we would need for both local storage and memory storage

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just do not like manually incrementing a counter here. Perhaps you could copy over the tracked-local-storage stuff or try using something similar.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i updated it, how about now?

test('Model types are successfully listed and bound', async function (assert) {
respondWith('data:getModelTypes', {
type: 'data:modelTypesAdded',
modelTypes: getModelTypes(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unclear on how this change tests the behavior. Could you please explain?

Copy link
Collaborator Author

@patricklx patricklx Oct 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so, the flow was the following (before this change):

  1. route waits for new models
  2. test sendMessage with initial models
  3. test if models appear on page

so there is no "update" to the page after initial render

now its like this

  1. route waits for new models
  2. test sendMessage with initial EMPTY models
  3. waits for page to load
  4. sendMessage with actual models
  5. test if models appear on page and thus checks if update works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ember data tab empty on initial render

4 participants