Skip to content

Commit

Permalink
refactor: add t parameter for plugin bundle resources
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Wang <i@ryanc.cc>
  • Loading branch information
ruibaby authored and halo-dev-bot committed Nov 2, 2023
1 parent 21fdfa3 commit 372dd31
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions console/src/setup/setupModules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export async function setupPluginModules(app: App) {
const { load } = useScriptTag(
`${
import.meta.env.VITE_API_URL
}/apis/api.console.halo.run/v1alpha1/plugins/-/bundle.js`
}/apis/api.console.halo.run/v1alpha1/plugins/-/bundle.js?t=${Date.now()}`
);

await load();
Expand All @@ -45,7 +45,7 @@ export async function setupPluginModules(app: App) {
await loadStyle(
`${
import.meta.env.VITE_API_URL
}/apis/api.console.halo.run/v1alpha1/plugins/-/bundle.css`
}/apis/api.console.halo.run/v1alpha1/plugins/-/bundle.css?t=${Date.now()}`
);
} catch (e) {
const message = i18n.global.t("core.plugin.loader.toast.style_load_failed");
Expand Down
2 changes: 1 addition & 1 deletion console/src/utils/load-style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export function loadStyle(href: string) {
return new Promise(function (resolve, reject) {
let shouldAppend = false;
let el: HTMLLinkElement | null = document.querySelector(
'script[src="' + href + '"]'
'link[href="' + href + '"]'
);
if (!el) {
el = document.createElement("link");
Expand Down

0 comments on commit 372dd31

Please sign in to comment.