{{ message }}
fix: DynamicLoading story, Codec and parseXml#125
Merged
Conversation
tbouffard
reviewed
Oct 22, 2022
Member
|
ℹ️ in the original mxGraph code, the getCodec function could take a string parameter.
We still have some remaining part after migration to TypeScript in Codec.decodeCell. So this method probably fails. I guess we could make getCodec takes a string parameter, and benefits from alias (as I mentioned in #102), but if the proposed implementation works with getCodecByName works, let's go for it. I will test the proposed implementation soon. |
Co-authored-by: Thomas Bouffard <27200110+tbouffard@users.noreply.github.com>
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
So I tried to fix
DynamicLoadingstory and stumbled across multiple problems.Problem 1 -
parseXmlnot returningDocumentmaxGraph/packages/core/src/util/xmlUtils.ts
Lines 37 to 39 in 61ab219
Don't know why it's added, but original code of
parseXmlreturningDocumentand notHTMLElement, which is breaking compatibility. In most casesparseXmlresult is used atCodecconstructor, which needsDocument.Removed
.documentElement.Problem 2 -
Codec.decodetrying to get constructors fromwindowmaxGraph/packages/core/src/serialization/Codec.ts
Lines 359 to 364 in 61ab219
It can work with vanilla JS imports, but bundlers (webpack) will kill this code very easy.
Added method
getCodecByNamefor getting constructor fromCodecRegistrydirectly by name, It's seems to work, don't really know about side-effects of this change, need advice.Problem 3 -
graph.container.clientWidthandgraph.container.clientHeightis always0in StorybookI don't understand why it's like that (maybe some CSS trickery), replaced it with
args.widthandargs.height.Description for the changelog
Fix
DynamicLoadingstoryRestored backward compatibility when using
parseXmlPossible fix for
Codec.decodemethod issueOther info
DynamicLoadingis fixed, but until #115 fix is merged, cells will not remove and story will look very strange 😸