taipy
taipy copied to clipboard
[🐛 BUG] Library Initialization Order Issue
What went wrong? 🤔
There is an issue when the ExampleLibrary is added after the page is declared using the builder method. The library does not work as expected unless it is added before the page declaration.
Reproduction Steps
- Add the
ExampleLibraryafter declaring the page usingbuilder. - Observe that the library is not functioning properly.
Workaround
Call Gui.add_library(ExampleLibrary()) before declaring the page.
Additional Context
The current implementation of ExampleLibrary looks like this:
class ExampleLibrary(ElementLibrary):
def init(self) -> None:
self.elements = {
"label": Element(
default_property = "textbody",
properties = {"textbody": ElementProperty(PropertyType.dynamic_string),
"sessionid": ElementProperty(PropertyType.dynamic_string),
},
react_component = "WordSelector",
),
}
def get_name(self) -> str:
return "example"
def get_elements(self) -> dict:
return self.elements
def get_scripts(self) -> list[str]:
return ["front-end/dist/exampleLibrary.js"]
Expected Behavior
The ExampleLibrary should work as expected regardless of when it is added relative to the page declaration.
Suggested Solution
Investigate the initialization order and update the documentation or library to ensure compatibility.
Acceptance Criteria
- [ ] Ensure new code is unit tested, and check code coverage is at least 90%.
- [ ] Create related issue in taipy-doc for documentation and Release Notes.
Code of Conduct
- [X] I have checked the existing issues.
- [ ] I am willing to work on this issue (optional)
When add_library is called, could Taipy inform the developer that it is too late? Like a warning saying: "you already used builder. be careful!"?
Hey @jrobinAV @FlorianJacta , I'm a first time contributor at Hacktoberfest. I would like to work on this issue. Can you please assign it to me?
Hi @heyysiri, you are assigned to this issue. Don't hesitate to talk with @FabienLelaquais and @FredLL-Avaiga about this issue. Thank you for your contribution
New Quest!
A new Quest has been launched in @Avaiga’s repo. Merge a PR that solves this issue to loot the Quest and earn your reward.
Some loot has been stashed in this issue to reward the solver!
🗡 Comment @quest-bot embark to check-in for this Quest and start solving the issue. Other solvers will be notified!
⚔️ When you submit a PR, comment @quest-bot loot #1776 to link your PR to this Quest.
Questions? Check out the docs.
Hey @FlorianJacta, is this resolved?
Not yet, do you want to be assigned to this issue also? @Namithesh
This issue has been labelled as "🥶Waiting for contributor" because it has been inactive for more than 14 days. If you would like to continue working on this issue, please add another comment or create a PR that links to this issue. If a PR has already been created which refers to this issue, then you should explicitly mention this issue in the relevant PR. Otherwise, you will be unassigned in 14 days. For more information please refer to the contributing guidelines.
This issue has been unassigned automatically because it has been marked as "🥶Waiting for contributor" for more than 14 days with no activity.