allow components to be locked to block height#9
allow components to be locked to block height#9mpeterdev wants to merge 2 commits intoNearSocial:masterfrom
Conversation
There was a problem hiding this comment.
- I'd prefer if we lock version using
@sign as part of src. For examplea.near/widget/Widget@524534. This way it makes it easier to lock it within a direct url. We can also use branches the same way - We should think about the default logic for children components. My original idea for block versions is that all children components will be automatically locked based on the height of the parent component. But it also might be undesirable in some situations. So we can add some modifiers on top of the height. E.g.
@=524534@^524534- or something like this.
src/lib/components/Widget.js
Outdated
| return acc[curr]; | ||
| }, componentVersionRes); | ||
| // console.log("component versions", componentVersions); | ||
| if (!componentVersions.includes(version)) { |
There was a problem hiding this comment.
I don't think this is quite necessary to check history, and this is also an expensive call. Probably the API can return a blockHeight at which the data was stored. So we can compare it this way if it's required.
There was a problem hiding this comment.
sounds good, I was leaning towards throwing an error if a matching version wasn't found to catch user error of specifying an incorrect block, but it doesn't need to be done here. If we care about that, we could do it during editing
I equally considered going that way, happy to make the change
Auto-locking is interesting. I would be inclined to push this change through such that it enables manual locking but doesn't affect global default behavior, then spin up a thread with more stakeholders to discuss changing default behavior as a later add-on. For the example of How about the following: alternatively for semver, do it npm-like down the road, allow explicitly specifying no lock if we decide to always require a version and want to support locking to parent, I could think of a number of options |
|
I think this is a good start |
|
closed in favor of #10 |
I branched off
0.3.0for testing in alpha.near.org — will rebase against main branch once changes are conceptually approvednote that this is only an attempt at block height versioning for meeting basic needs. We should trend towards semver as a best practice but that will take more time to implement
example usage:<Widget src="mpmain2.near/widget/VersionTestInner" version="86775507" />example usage:
<Widget src="mpmain2.near/widget/VersionTestInner@86775507" />