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

fix: added context in item-template #886

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

sagardspeed2
Copy link
Contributor

@sagardspeed2 sagardspeed2 commented Oct 25, 2024

Describe your changes

Added context in item-template of collapsible widget

Screenshots [Optional]

After

image

Issue ticket number and link

Closes #885

Checklist before requesting a review

  • I have performed a self-review of my code
  • I have added tests
  • I have added a changeset pnpm changeset add
  • I have added example usage in the kitchen sink app

Copy link

changeset-bot bot commented Oct 25, 2024

🦋 Changeset detected

Latest commit: dd58363

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@ensembleui/react-kitchen-sink Patch
@ensembleui/react-runtime Patch
@ensembleui/react-preview Patch
@ensembleui/react-starter Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Oct 25, 2024

Visit the preview URL for this PR (updated for commit dd58363):

https://react-kitchen-sink-dev--pr886-885-context-in-item-4y5vbs4w.web.app

(expires Thu, 21 Nov 2024 07:04:11 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 6267897ade2ba783b6db70a53a60fc3946d625e9

Copy link
Contributor

@evshi evshi left a comment

Choose a reason for hiding this comment

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

Please write a test suite to avoid regressions

packages/runtime/src/widgets/Collapsible.tsx Show resolved Hide resolved
packages/runtime/src/widgets/Collapsible.tsx Outdated Show resolved Hide resolved
data: [1, 2, 3]
name: p
template:
CollapsibleItem:
Copy link
Contributor

Choose a reason for hiding this comment

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

There is no Collapsible item in flutter I believe.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are supporting Collapsible and Accordion as Collapsible widget in react to give backward compatibility for atlas

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes but there is no CollapsibleItem in flutter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes I know and also we are not using anywhere, I got this example reference from Anser, we are only using properties of template from itemTemplate

Copy link
Contributor

Choose a reason for hiding this comment

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

Remove this then and put the key back into itemTemplate?

packages/runtime/src/widgets/Collapsible.tsx Outdated Show resolved Hide resolved
packages/runtime/src/widgets/Collapsible.tsx Outdated Show resolved Hide resolved
packages/runtime/src/widgets/Collapsible.tsx Outdated Show resolved Hide resolved
packages/runtime/src/widgets/Collapsible.tsx Outdated Show resolved Hide resolved
const [evaluatedItems, setEvaluatedItems] = useState<CollapsibleTemplate[]>(
[],
);
const [currentIndex, setCurrentIndex] = useState(-1);
Copy link
Contributor

Choose a reason for hiding this comment

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

Do not do this! Why did you no longer make this a component? This is going to be n renders of the entire Collapsible component instead of individual smaller renders.

Change this back to a component. Add a check in the parent Collapsible component so that it doesn't render anything until all the keys have been evaluated.

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.

No Context in item-template of Collapsible widget
2 participants