GithubHelp home page GithubHelp logo

Comments (5)

zagriswo avatar zagriswo commented on May 27, 2024 1

Yea, we have a workaround we can use for now. Just not ideal :)

from fluidframework.

zagriswo avatar zagriswo commented on May 27, 2024

Updating the title. This repros when searching backward at the beginning of the string too.

it("Repro findTile() issue [backward]", async () => {
    // ARRANGE
    const sharedString = ...; // Get an empty SharedString somewhere

    // ACT
    sharedString.insertMarker(0, ReferenceType.Tile, {
        markerId: "marker",
        referenceTileLabels: ["Eop"],
    });

    // ASSERT
    expect(sharedString.getLength()).toBe(1);

    // There shouldn't be anything before the beginning of the string...
    const foundTile = sharedString.findTile(0 /*startPos*/, "Eop" /*tileLabel*/, true /*preceding*/);
    // ... but for some reason, we're getting the marker at pos 0... 🧨🧨🧨
    expect(foundTile).toBeUndefined();
});

from fluidframework.

Abe27342 avatar Abe27342 commented on May 27, 2024

Thanks for the bug report! We already have some work internally tracking improving test coverage on findTile and related underlying functionality--more reason to prioritize that. I've filed a bug for this as well (AB#4616 for FF team members)

Do you have any workaround in the meantime (assuming this is blocking you in some way)? Seems like the kind of thing that might have one if you understand what scenarios it repros in.

from fluidframework.

jzaffiro avatar jzaffiro commented on May 27, 2024

I'm working on this issue now, and in doing so we've decided to create a new function that searches by doing a depth first walk of the nodes instead of the current search block functions that we have. We're trying to decide whether the search should exclude the search position that's passed into findTile, whether it should be included in the search, or if we should allow the method to be configurable on whether or not the position is included in the search.

Currently, findTile seems to include 0 as a search position, but exclude any other position in the middle of the string. If the new method is fully exclusive, it would prevent any tile at position 0 from being found in a forward search, but it would match the behavior of the forwardExcursion and backwardExcursion functions. If it's inclusive, the problem with searching at the start of the string is fixed, but it could break some expectations from previous findTile usage.

Let me know if you have a preference as to which solution we move forward with, or if you would be ok with whatever our preference is. None of the existing usage of findTile would be broken immediately, as this solution is for a separate method, but let me know what your thoughts are.

from fluidframework.

jzaffiro avatar jzaffiro commented on May 27, 2024

Closing since the solution is merged (#16517). findTile itself is now deprecated in favor of searchForMarker, which is called in the same way as findTile and searches for the nearest marker in the direction indicated. searchForMarker includes the start position in the search as well.

from fluidframework.

Related Issues (20)

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.