question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

currentPath is not updated when element position in array changes

See original GitHub issue

When an element’s position in the array changes, this change is not reflected in the currentPath and jsonPointer properties of the change object:

Repro

const ObservableSlim = require('observable-slim');
const proxy = ObservableSlim.create([{}, {}]);

ObservableSlim.observe(proxy, changes => changes
  .forEach(change => console.log(change.currentPath, change.type)));

proxy.splice(0, 1);
proxy[0].foo = 'bar';

Before: [{}, {}] After: [{foo: 'bar'}]

Result

0 update
1 delete
length update
1.foo add

However, it should read 0.foo add, as the object now is the first item of the array.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ElliotNBcommented, Aug 10, 2018

@christianliebel I worked on this issue today and I have it very nearly fixed. I’m hoping to push the fix either tomorrow or Monday.

0reactions
christianliebelcommented, Aug 13, 2018

@ElliotNB Looks good, thanks a lot for implementing this fix! I’ve encountered another array-related issue though (at least I think so), but I’ll open another issue for that.

Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

react-router v6: get path pattern for current route - Stack Overflow
I made a custom hook useCurrentPath with react-router v6 to get the current path of route, and it work for me. If the...
Read more >
C++ O(n) time O(1) space 0 ms - LeetCode Discuss
Mark all visited elements in current path +n or -n depending on current direction. In this way, the "jump information" is not changed...
Read more >
Postscript Operators 'p'
For each element in the path, pathforall pushes the element's coordinates on the ... If any of the procedures change the current path,...
Read more >
solidjs/solid-router - GitHub
The function will be called with: from (Location): current location (before change). to (string | number}: path passed to navigate . options ( ......
Read more >
A look at React Router 6 | Building SPAs - Carl Rippon
Whenever the location changes, Routes finds the child Route element that best matches the path prop to the current location and renders the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found