Skip to content
New issue

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

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

Already on GitHub? # to your account

fix: allow to render array of elements in root component #30

Merged

Conversation

tomek-r
Copy link
Contributor

@tomek-r tomek-r commented Jul 1, 2022

What did you implement:

Consider such example code

function render() as Object
  if m.top.content = invalid then return invalid
  
  return [
     {
       name: "Label"
       '....
     },
     {
       name: "Label"
       '....
     }
  ]
end function

When the component is the root and after the next render tick (content is no longer invalid) Kopytko breaks:

Current Function:
063:  sub (elements as Object)
064:      rootElement = m._getRootComponent()
065:  
066:      for each element in elements
067:*       if (element.parentId = Invalid)
068:          parentElement = rootElement.top
069:        else
070:          parentElement = rootElement[element.parentId]
071:        end if
Source Digest(s): 
pkg: dev 1.1.1 f31f77289f1bee3045ec26c97485a566 Kopytko Unit Testing Framework App

Syntax Error. (runtime error &h02) in pkg:/components/renderer/KopytkoDOM.brs(67)

How did you implement it:

When an element is of array type and it is the root component the parent component is one level above it.

How can we verify it:

Run unit tests

Todos:

  • Write documentation (if required)
  • Fix linting errors
  • Enable "Allow edits from maintainers" for this PR
  • Update the messages below

Is this ready for review?: YES
Is it a breaking change?: NO

@tomek-r tomek-r requested a review from a team as a code owner July 1, 2022 10:00
@tomek-r tomek-r requested review from bchelkowski and tomska235 and removed request for a team July 1, 2022 10:00
@bchelkowski bchelkowski merged commit 8609122 into getndazn:master Jul 14, 2022
github-actions bot pushed a commit that referenced this pull request Jul 14, 2022
## [1.1.2](v1.1.1...v1.1.2) (2022-07-14)

### Bug Fixes

* allow to render array of elements in root component ([#30](#30)) ([8609122](8609122))
@github-actions
Copy link

🎉 This PR is included in version 1.1.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants