Coder Social home page Coder Social logo

有几个小错误 about stateshot HOT 3 OPEN

julyL avatar julyL commented on August 19, 2024 3
有几个小错误

from stateshot.

Comments (3)

xiaoluoboding avatar xiaoluoboding commented on August 19, 2024

@julyL @doodlewind 问题的第二点,我实测应该是对的。

from stateshot.

julyL avatar julyL commented on August 19, 2024

@xiaoluoboding
框架内部通过维护 $records数组和$index 来记录状态
前3次执行pushSync, 内部会向$records存入3个操作,2次undo,改变$index--
第三次pushSync会将 $record[2]置为null ,pushSync内部代码如下

    for (let i = this.$index + 1; i < this.$records.length; i++) {
      this.$records[i] = null
    }

第三次pushSync之后,实际上$records里面只存储了2个有效操作
image
但是length的取值并没有过滤null值

  get length() {
    return Math.min(this.$records.length, this.maxLength)
  }

from stateshot.

doodlewind avatar doodlewind commented on August 19, 2024

谢谢你的定位,近期刚好也有其他维护需求,待我这顺便处理下哈

from stateshot.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.