This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to master, this PR will be updated.
Releases
@telegram-apps/bridge@1.3.0
Minor Changes
5346f76: "Add web_app_share_to_story" to supports checks.
@telegram-apps/sdk@2.5.0
Minor Changes
34b2595: We realized that many developers might be using the SDK without knowing that some functionality they're using may not work. This is due to the non-strict postEvent function in the init function:
import { init } from "@telegram-apps/sdk";
init({
postEvent: "non-strict",
});
Using the non-strict postEvent can lead to bugs that developers are unaware of. For example:
backButton.onClick(() => {
// User clicked the button, navigate to a new page.
navigate("market");
});
backButton.show();
In this case, if the show method is unsupported, and the postEvent function is non-strict (not throwing an error, only using console.warn), the user could get stuck on the current screen without any indication to the developer.
To prevent such scenarios, we now disallow non-strict postEvent. Only a custom postEvent function can be passed. This way, you can bypass the protection mechanism, but you'll be fully aware of the risks. This function can also be used to decorate the original postEvent from the SDK.
Since we no longer allow non-strict actions, most component and utility methods now include the isSupported property. For example:
import { backButton } from "@telegram-apps/sdk";
if (backButton.mount.isSupported()) {
backButton.mount();
backButton.show();
}
Calling the mount method without checking if it's supported may throw an error if the method is unsupported in the current Mini App version.
Additionally, if a component has the mount method, many of its other methods now check if the component was mounted. If it wasn't, an error will be thrown. This behavior ensures that you are working with components within their intended lifecycle.
For example, the following code will throw an error:
import { backButton } from "@telegram-apps/sdk";
backButton.show();
// TypedError('ERR_NOT_MOUNTED') will be thrown
This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to master, this PR will be updated.
Releases
@telegram-apps/bridge@1.3.0
Minor Changes
supports
checks.@telegram-apps/sdk@2.5.0
Minor Changes
34b2595: We realized that many developers might be using the SDK without knowing that some functionality they're using may not work. This is due to the non-strict
postEvent
function in theinit
function:Using the non-strict
postEvent
can lead to bugs that developers are unaware of. For example:In this case, if the
show
method is unsupported, and thepostEvent
function is non-strict (not throwing an error, only usingconsole.warn
), the user could get stuck on the current screen without any indication to the developer.To prevent such scenarios, we now disallow non-strict
postEvent
. Only a custompostEvent
function can be passed. This way, you can bypass the protection mechanism, but you'll be fully aware of the risks. This function can also be used to decorate the originalpostEvent
from the SDK.Since we no longer allow non-strict actions, most component and utility methods now include the
isSupported
property. For example:Calling the
mount
method without checking if it's supported may throw an error if the method is unsupported in the current Mini App version.Additionally, if a component has the
mount
method, many of its other methods now check if the component was mounted. If it wasn't, an error will be thrown. This behavior ensures that you are working with components within their intended lifecycle.For example, the following code will throw an error:
Patch Changes
@telegram-apps/navigation@1.0.4
Patch Changes
@telegram-apps/sdk-react@2.0.7
Patch Changes
@telegram-apps/sdk-solid@2.0.7
Patch Changes