Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work with immutable records #120

Closed
Vincz opened this issue Jul 26, 2022 · 5 comments
Closed

Doesn't work with immutable records #120

Vincz opened this issue Jul 26, 2022 · 5 comments

Comments

@Vincz
Copy link
Contributor

Vincz commented Jul 26, 2022

I'm working with GraphQL generation and the records of my data source are immutable (non extensible objects) (see: https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Global_Objects/Object/preventExtensions).

So this line:

trs[0].props.record[row_idx] = 0;
doesn't work and triggers the following error: TypeError: Cannot add property Symbol(idx), object is not extensible

Would it be another way to keep the index? Maybe with a map using rowKey as key?

@wubostc
Copy link
Owner

wubostc commented Jul 27, 2022

Every row needs an index that held with the prop record, which I can determine the true index number of every row, and don't worry about whether the dataSource is a tree-structure or a nested-structure.

To solve this problem, I have to write something like row.props.record[row_idx] to keep a true index number

Could you solve this problem instead of that I mentioned above, and create a new PR with a branch?

Tips: there are a few things need to be changed below (at least)

  1. Initial state within VTWarpper
    trs[0].props.record[row_idx] = 0;
  2. Running state within VTWarpper
    trs.forEach(el => el.props.record[row_idx] = idx++);
  3. Determining the true index number within VTRow
    const index: number = row_props.record[row_idx];

@PunkOnWheels
Copy link

Has there been any progress on this? I am now running into this issue too.

@wubostc
Copy link
Owner

wubostc commented Sep 27, 2022

@PunkOnWheels I haven't had any ideas so far
0147C7AE

@Vincz
Copy link
Contributor Author

Vincz commented Dec 4, 2022

Hi @wubostc
Made an attempt here: #132

@wubostc
Copy link
Owner

wubostc commented Dec 8, 2022

@Vincz @PunkOnWheels solved! 👍

@wubostc wubostc closed this as completed Dec 8, 2022
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

No branches or pull requests

3 participants